function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
tfoiltfoil 

A button inside a apex:form problem

Hello, 
I have a apex:form with some "apex:inputField" inside it.
I want to click a button that fills some values in those inputFields (using jscript).
Than the user can use another buttom to Save (using apex) those values.
I already made everything. But when i click de jscript buttom, the page blinks the values, than after some secs it disapears.
If I put the jscript button outside the apex:form tag. It works. But i do need it inside, near the inputFields.

Can someone give any help?
 
Best Answer chosen by tfoil
Shashikant SharmaShashikant Sharma
Hi,

You could make return false; statment from your java script funciton which populates value like below example.
<apex:commandButton onclick="return jsfunction();" />

<script>
function jsfunction() {
// your code

return false;

}
</script>

If above does not work then please share your code.

Thanks
Shashikant 

All Answers

Shashikant SharmaShashikant Sharma
Hi,

You could make return false; statment from your java script funciton which populates value like below example.
<apex:commandButton onclick="return jsfunction();" />

<script>
function jsfunction() {
// your code

return false;

}
</script>

If above does not work then please share your code.

Thanks
Shashikant 
This was selected as the best answer
tfoiltfoil
Thank you very much, Shashikant Sharma
It worked perfectly!