Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function works 1X

Status
Not open for further replies.

db96s1

Technical User
Feb 2, 2006
5
US
php5, apache2, mysql5

I have a form that receives a drop down list box selection, loads a hidden field, and after the submit button is clicked it builds a detail record based on the selection. before i started sql coding the onchange select box function was happy to feed the hidden input with new values time and time again. It seems that after a POST nothing about the onchange function works. I would like to stay onscreen and make selection after selection but I do not understand how to reinitialize the onchange select box function.

i hope i have explained this well enough.

Thank You for your time.

db96s1
 
Try running the page using Firefox ( Watch out for the red "warning" icon in the upper right corner (this is a button) - this will show up if there is a Javascript error. Click it to see a list of the errors... a lot more useful than the IE ones (imho).

Sorry to rant if you already knew this - but if not... it may certainly help you narrow down where the problem is happening in your code.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Another technique is to place alert("I am on line 25 and variable X has the value: " + X) statements in the Javascript to see what is going on. Of course remove them after you solve the problem.


"I would like to stay onscreen and make selection after selection but I do not understand how to reinitialize the onchange select box function."

"...stay onscreen..."

That is not really possible. It is possible to arrange things so that it appears that you stay on the same screen, but it just looks that way. A POST is a request to the web server to process the form data and send a new page. The new page is a different page, no matter what. In particular the hidden field will have the initial value, and any Javascript variables will be initialized. And that implies that the onchange function is also initialized. So "reinitializing" is not the issue.

There is a recent addition to Javascript, XMLHTTPRequest, which can request data from the web server without getting a new page. This sounds like what you wish to do, "...make selection after selection...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top