You need to sign in to do that
Don't have an account?
Leonardo Wu
How should I execute the method in the custom object and execute the js code at the sametime
This is my custom object method,I use it to update my list;
I also write a js code under the button. But when I done the js code, the page can jump,but my custom metod is not execute.
I want ask how should I can execute the custom object method,and also execute the js method.
Thin
I also write a js code under the button. But when I done the js code, the page can jump,but my custom metod is not execute.
I want ask how should I can execute the custom object method,and also execute the js method.
Thin
You can execute the javscript method(change();) ,after execution of Action method(getSave()).
Below is the code to execute it in the above specified order. Change onClick to onComplete event in the VF Page.
Once you click on the custom button, the action method will start execute. If the action method is succesfully executed , then the javascript action OnComplete will start execute.
If there are any validation errors while executing the action method, then the javascript action onComplete won't execute.
As you said above in onClick event, Both the methods will initaite at same time.
Hope this will help .
Thanks
Satya.
All Answers
onclick="change();"
replace it with
onclick="return change();"
In the change() fucntion body
remove these statements
window.opener.location.href
window.close();
and add this statement
return false;
You could navigate with apex class method by making return type as PageReference instead of void.
Thanks
Shashikant
You can execute the javscript method(change();) ,after execution of Action method(getSave()).
Below is the code to execute it in the above specified order. Change onClick to onComplete event in the VF Page.
Once you click on the custom button, the action method will start execute. If the action method is succesfully executed , then the javascript action OnComplete will start execute.
If there are any validation errors while executing the action method, then the javascript action onComplete won't execute.
As you said above in onClick event, Both the methods will initaite at same time.
Hope this will help .
Thanks
Satya.
Thanks for your help. And it's really working.