Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Javascript Help

  • 30-07-2008 8:49am
    #1
    Registered Users, Registered Users 2 Posts: 3,428 ✭✭✭


    Lads again my JS knowledge is letting me down in AJAX.

    My ajax is returning the code
    addPubNum( 5940, '1796 Wolfe Tone Bar' , 'pubid1' );
    

    This function can be seen here:
    function addPubNum( id, name, pubnum ) {document.forms['addpub'].elements[ pubnum ][ document.forms['addpub'].elements[ pubnum].length ] = new Option( name, id );}
    

    The problem is that this function/code isn't populating the form:
    <table width="100%">	<form name="addpub" action="userpage.php" method="GET">
    																
    	<tr><td colspan="2">Please Enter Your 1st Pub</td></tr>
    	<tr><td><select name="countyid" onChange="showPubNum(1,this.value);"><option value="0">Select County</option>
    	<option value="1">Antrim</option>
    	<option value="2">Armagh</option>
    	</select></td>		
    	<td><select name="pubid1"><option value=""></option></select> </td></tr>
    	<tr><td colspan="2" align="right"><input type="submit" value="Add"></td></tr>
    
    	</form></table>
    


    If anyone could see an error off the top of their head that would be great!

    P.S. -> showPubNum(1,this.value); is working fine!


Comments

  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    It works fine for me when I call the addPubNum from a button, so perhaps it's the way the function is being called.


  • Registered Users, Registered Users 2 Posts: 3,428 ✭✭✭randombar


    That's strange?

    The page can be found here: http://www.ratemypub.ie/userpage.php the ajax is ran when you select a county.

    Using the basic:
    eval( xmlHttp.responseText  )
    

    to call it?


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    I think I found it.

    try changing this:
    xmlHttp.onreadystatechange = stateChangedPubNum()
    to
    xmlHttp.onreadystatechange = stateChangedPubNum


  • Registered Users, Registered Users 2 Posts: 3,428 ✭✭✭randombar


    Woo Hoo, LEGEND!


Advertisement