|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
Problems with form fields (and Javascript?)
I have two related(?) problems. I have the "typical" self-validating page where it includes a form which posts back to the page on submittal. It also has the if (isset($HTTP_POST_VARS["submit_name"])) line that leads into the form validation. The form has a submit button with name="submit_name" and a few input/text fields such as "input1", "input2", etc.
Problem #1: I'm having some problems with getting form fields sent to the server when using Javascript's document.form.submit(). When I use the submit button to directly post to the validation, $HTTP_POST_VARS["submit_name"] is defined as are all the input fields. However, when I use document.form.submit(), only the input fields are defined. The submit_name isn't. Therefore, the initial isset() on the form submit_name fails and there's no validation done. Problem #2: The form has some fields which are dependent on other user inputs. The user selects an item from a list which then changes a calculation elsewhere on the field. When I submit the form, I'm only getting the user-modified fields and none of the dependent ones. Javascript is used to make the field alterations during an onchange action. |
|
#2
|
|||
|
|||
|
RE: Problems with form fields (and Javascript?)
image, and submit type fields are only sent if you press them, so no, if you use javascript.
but you can put a hidden field of name "submit_name" that will be sent regardless of the method... |
|
#3
|
|||||
|
|||||
|
RE: Problems with form fields (and Javascript?)
Great - that "solves" problem #1. Is there a site that gives this sort of information instead of php.net? php.net just lists what the global variables are but nothing like what you just mentioned. And most form tutorials just give the self-validation example.
Now, what about problem #2? For a bit more help, here's a pseudo snippet (the real code's inaccessible at the moment). php Code:
When I hit the sub_btn after making a change to field1 (and through the javascript, field2), I get $HTTP_POST_VARS["field1"] but not $HTTP_POST_VARS["field2"]. |
|
#4
|
|||||
|
|||||
|
RE: Problems with form fields (and Javascript?)
there are several things missing/bad in your code sample..
but this works for me. i change first field to 7 and click submit, and get 8 in the second field in php... php Code:
|
|
#5
|
|||||
|
|||||
|
RE: Problems with form fields (and Javascript?)
How about this? This works for me too!
php Code:
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > Problems with form fields (and Javascript?) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|