You need to sign in to do that
Don't have an account?
java.lang.IllegalArgumentException: Illegal view ID myfunction(). The ID must begin with /
my visual force page:
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<p id= "demo"> hello
</p>
<apex:inputField value="{!borrower__c.borrowers_name__c}"/>
<apex:inputField value="{!borrower__c.borrowers_id__c}" id="eng"/>
<apex:inputField value="{!borrower__c.current_year__c}" id="mat"/>
<apex:inputField value="{!borrower__c.Staff__c}" id="sci" onchange="showhidefield();"/>
<apex:inputField value="{!borrower__c.ADDRESS__c}" id="soc"/>
<apex:commandButton value="click me" action="myfunction()"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
my java script :
<script language="JavaScript">
function showhidefield()
{
if (document.getElementById("j_id0:j_id2:j_id3:j_id4:sci").checked)
{
document.getElementById("j_id0:j_id2:j_id3:j_id4:eng").style.visibility = "hidden";
}
else
{
document.getElementById("j_id0:j_id2:j_id3:j_id4:eng").style.visibility = "visible";
}
}
function myFunction()
{
x=document.getElementById("demo") // Find the element
x.style.color="#ff0000"; // Change the style
}
</script>
can any one let me know where i went wrong ???
Well I guess you are making a basic mistake here
The action attribute binds controller methods, in your case you are binding js function.
So to call a jsfunction you can use the onclick event. Something like this
All Answers
Hi,
http://boards.developerforce.com/t5/Visualforce-Development/java-lang-IllegalArgumentException-Illegal-view-ID-this-is-next/td-p/257249
You can find it in this thread.
If this post solves your problem kindly mark it as solution. if this post is helpful please throw Kudos.
Thanks
Well I guess you are making a basic mistake here
The action attribute binds controller methods, in your case you are binding js function.
So to call a jsfunction you can use the onclick event. Something like this