Re: form field update
| From: | Chris Shiflett | Date: | Mon, 17 Jun 2002 02:55:24 +0000 |
| Subject: | Re: form field update | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-102461@lists.php.net to get a copy of this message | ||
That sounds like you want the page to change dynamically based on actions taken by the client prior to actually submitting the form.
In that case, your *only* option is client-side scripting, because until another request comes from the client, the server (PHP included) isn't going to have a chance to do anything.
Going back to your original question (which makes more sense now), the method of automatically submitting the form is probably bad (you generally want to let the users submit the form themselves), but you might consider altering your overall design to fit in with the idea of the Web more - if you have "conditional" questions, make sure you ask the prerequisite questions first.
For example, if you want to know what someone's favorite color is only if they are a female, else you want to ask what the person's favorite sport is, do something like this:
Page 1:
What is your sex? ___ M ___ F ___ Other
Submit
Page 2 (if female):
What is your favorite color? ________
Submit
Page 2 (if male or other):
What is your favorite sport? ________
Submit
Trying to cram both questions on a page with overly complex client-side scripting is a poor design decision, so long as you're actually free to design it yourself. :) If not, crack open a book on JavaScript. :)
Chris
Peter wrote:
ok to make it clearer...
<form ......>
<other form stuff>
<select name="machine_group" size="1" id="machine_group">
<option value="ws" >Work Station</option>
<option value="serv" >Server</option>
<option value="stor">Storage</option>
<option value="bu">Back Up</option>
</select>
<select name="machine_type" size="1" id="machine_group">
the info in here needs to be gathered depending on what was selected
<option value="$value" >$machine_type</option>
</select>
<more form stuff>
</form>
now what i want to do is have the option values in machine_type to
automatically load depending on what was selected in machine_group with the
options in machine_type repeating until no more records are found matching.
The repeating part i can do no worries .. hope this made sence
**All other form info must be retained....**
-----Original Message-----
From: Martin Towell [mailto:martin.towell@world.net]
Sent: Monday, 17 June 2002 11:46 AM
To: 'Peter'; Php
Subject: RE: [PHP] form field update
depends on what's being updated (and where that info is coming from), and if
you're willing to allow the data the user has typed in to disappear after a
refresh
-----Original Message-----
From: Peter [mailto:php@vfsa.com.au]
Sent: Monday, June 17, 2002 11:50 AM
To: Php
Subject: [PHP] form field update
howdy,
I am building a page that relies on a form...
what I am unsure of is ..
is it better to try and have form fields update them selves, using java
script or the like or have the whole page refreshed with out being submitted
given there will be other data entered on the page..
Cheers
Peter
"the only dumb question is the one that wasn't asked"
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php