salesforce - Javascript Function Not Getting Called after setFocus() call -


i using java-script in salesforce application , in middle of bizarre situation.

i have used below code in visualforce page.

<script>     var previousonload = window.onload;     window.onload = function() {         if (previousonload) {             previousonload();         }          rendersection('false');         setfocus();     }      function setfocus() {         document.getelementbyid("{!$component.thepageblock.state}").focus()     }      function rendersection(input) {         if (input == true) {             document.getelementbyid("{!$component.thepageblock.thesection}").style.display='block';         }     } </script> 

the problem facing after setfocus() function called other function rendersection() not called. when remove setfocus() , try, rendersection() called. seen in above code have tried giving rendersection() before setfocus(). still not work. know if missing here?

also, when tried change setfocus() different putfocus or getfocus function called focus not set desired field.

thanks


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -