Tag Archives: JavaScript

Prevent page redirection on Apex Command Button through JavaScript

We had a requirement to add client side validation on Apex Command Button but the page was getting redirected after successful validation. So, we tried the following JavaScript code to prevent the page redirection but it didn’t work.We then found a solution to stop redirection by adding the following code at the Command Click Event.… Read More »

Set controller variable/properties from JavaScript

Sometimes we need to pass values to apex code or assign the controller properties in JavaScript. Here is the trick that we can use to set a value to an apex variable/properties from JavaScript code using <apex:inputTextarea>  tag in Visualforce Page. <apex:inputTextarea id=”setDataStringValue” value=”{!setDataStringValue}” styleClass=”exampleDataToSetVariable” style=”display:none;”/> We will set the value ‘data’ in JavaScript function… Read More »