Uncategorized

how can we use javascripts in visualforce pages?

<apex:page sidebar=”false” showheader=”false”> <script> function changeFontColor(Id,textValue) { if(Id.checked) { document.getElementById(textValue).style.fontWeight = “bold”; document.getElementById(textValue).style.color= “green”; } else { document.getElementById(textValue).style.fontWeight = “Normal”; document.getElementById(textValue).style.color= “black”; } } </script> <apex:outputPanel layout=”block”> <label for=”checkbox”>Click this box</label> <input type=”checkbox” id=”check1″ onclick=”changeFontColor(this,'{!$Component.theOutputPanel}’);” /> </apex:outputPanel> <apex:outputPanel id=”theOutputPanel” layout=”block”>Change…

Read More
Uncategorized

Get values of form field in javascript from a visualforce page

<apex:page > <script language=”javascript”> function getCheckBoxValue() { alert(document.getElementById(‘{!$Component.myForm.pb1.pbs1.checkbox1}’).checked); } </script> <apex:form id=”myForm”> <apex:pageblock id=”pb1″> <apex:pageblockSection id=”pbs1″> <apex:inputCheckbox id=”checkbox1″ label=”Check Me” onclick=”javascript:getCheckBoxValue();”></apex:inputCheckbox> </apex:pageblockSection> </apex:pageblock> </apex:form> </apex:page>

Read More
Uncategorized

Passing parameters with Command Link

create a command link and pass arguements. In the apex class you can get the parameters and use the value in your code. Visual Force Page: <apex:page controller=”showCammand”> <apex:form> <apex:commandLink id=”commandLink” action=”{!displayName}” value=”Show my name”> <apex:param name=”Name” value=”myName”/> </apex:commandLink> <br/>…

Read More