Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,381
    Thanks
    264
    Thanked 32 Times in 31 Posts

    instead of onchange

    I have an input like this

    Code:
    <input type="text"  name="handle" id="handle" size="20" value="<?=$_SESSION['post']['txtHandle'];?>" tabindex='1' onchange="toggle_handle(this.value)" />
    the issue is that i am now changing that to a auto generated value so i had to change it to readonly and in doing so now my onchange wont work because im not inputing the value so it does not see the change.

    Code:
    <input type="text"  readonly="readonly"  name="handle" id="handle" size="20" value="<?=$_SESSION['post']['txtHandle'];?>" tabindex='1' onchange="toggle_handle(this.value)" /> 
    
    //need to execute it here or in the input if i can
    Question is what can i use to execute the toggle_handle now. What are my option, i obviously cant use onchange, and onfocus and onblur is out im sure because it is readonly. I tried onload just to test but that dont work lol

    Any suggestions in order to excute that right after its loaded

    thanks

    UPDATE i did get the onclick to work but you have to click on it, but thats ok its better than nothing. if i just put the call to the function it wont execute until the form is done and thats not what i want. I wish there was a way to just let it execute in exactly the same manner as the onchange but allow it to sense the onchange automatically.
    Last edited by durangod; 11-26-2012 at 01:57 PM.

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,632
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Simply put the code at the bottom of the web page so it runs as toon as the HTML finishes loading
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,381
    Thanks
    264
    Thanked 32 Times in 31 Posts
    Thanks i tried that but didnt work.

    here is the bottom of my page its split into several sections this is the first process section for a multi form

    Code:
    //finish up page one below 
    
    </td></tr></table></div><div class="page-bottom"></div><br /><div align="right"> <input type="image" src="<?=$SKIN_IMAGE_PATH?>/step2.gif" name="Submit" value="Continue to STEP 2 >>" style="color:#71293e" tabindex="8"></div>
    </form></div>
    
    //footer that has some html in it
     <?=$skin->ShowFooter($area)?>
    
    <!-- this should run after page loads as soon as the html is done -->
    <script type="text/javascript">
    toggle_handle($value); 
    </script>
    
    
    
    <?php
     }//end of page, last php command nothing further on page at all
     ?>

  • #4
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,381
    Thanks
    264
    Thanked 32 Times in 31 Posts
    What i ended up doing is just not using the ajax listener for that event. I just hard coded the php and js in that section rather that use the ajax.

    Thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •