ginerjm Posted March 10, 2012 Share Posted March 10, 2012 From my reading I believe that the onclick event that calls my js function happens before the button (submit) that triggered it actually triggers the php script designated in the form tag. Here's my problem. The JS function that is called by the onclick does some verification that may end up altering the value of a field in the form being submitted. What I'm seeing is that the change to the field is NOT getting picked up by the POST in the php script triggered by the submit button. Is that normal? My debugging tells me that the modification to the field takes place in the js function, and I can even see the change on my screen. But - when the script executes my echos tell me that the value didn't get picked up. It seems that the POST vars are collected as soon as I click on the form's submit button, then the onclick JS function does its thing, and then finally the php script gets called, using the POST vars that had already been created. Is this true? Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 10, 2012 Author Share Posted March 10, 2012 Not an Answer - but problem solved. Since my js submit can't send the text of the submit button that triggered it and therefore my php script didn't know where the submit was coming from I did this. Since the form that was involved had field names unique to that portion of my webpage, I just checked for the existence of one of those names and set the button field name=the text that is in the value= parm. That allowed my script to think that it was coming from the appropriate form and my work can continue. Interestingly enough - the problem wherein an html field that I modified in the JS function prior to the submit now shows up correctly in the PHP script, whereas when I was trying to let the submit button trigger the submit event after the onclick was complete, I was losing the value of that modified field. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.