The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> JavaScript Development
|
Form design: unknown number of date fields in form?
Discuss Form design: unknown number of date fields in form? in the JavaScript Development forum on Dev Shed. Form design: unknown number of date fields in form? JavaScript Development forum discussing JavaScript and DHTML, AJAX, and issues such as coding cross-browser JavaScript.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

September 19th, 2005, 12:21 PM
|
|
Registered User
|
|
Join Date: Sep 2005
Posts: 3
Time spent in forums: 58 m 5 sec
Reputation Power: 0
|
|
Form design: unknown number of date fields in form?
I've searched the forum for something similar to this, but it's tough to really describe my problem in a less than verbose way, so I'm gonna post my problem and hopefully some of the big brains around here have some ideas...
I'm designing a medical form for a client and have a few questions on the form that are yes/no answers, basic radio button style. My problem lies in when a user chooses yes, because then I need to collect a series of dates from them (medical history type info), and there could be 1 date, there could be 20. For example, if the question is "recent x-rays?" yes or no, and they choose yes, I need to collect the dates of the recent x-ray(s), and there could be 1 x-ray they've had recently, or 20 over the course of a few years.
I've thought about putting a little iframe next to the yes/no piece, with a list of date fields that users could fill in, but my problem with that lies in how to submit the iframe data with the rest of the form which is of course not in the iframe. Of course, I'm open to ANY ideas or methods anyone has, I'm definitely not locked into the iframe idea at all.
Any thoughts? The users of this form will be a controlled group, so I CAN put restrictions on browser use, for example locking them into IE6 with JavaScript turned on, etc.
Thanks in advance!
Mike
|

September 19th, 2005, 01:44 PM
|
 |
mod_dev_shed
|
|
Join Date: Sep 2002
Location: Atlanta, GA
|
|
|
You can do this client-side with JavaScript, or server side with any server-side language. If you can guarantee the availability of JavaScript, that's my recommendation b/c it will be quicker and more user friendly. But the choice is really yours.
__________________
# Jeremy
Explain your problem instead of asking how to do what you decided was the solution.
|

September 19th, 2005, 01:50 PM
|
|
Registered User
|
|
Join Date: Sep 2005
Posts: 3
Time spent in forums: 58 m 5 sec
Reputation Power: 0
|
|
|
Thanks for the reply jharnois. Can you give me a little detail as to how you'd do it? If I use an iframe, ideally I'd like the whole form, including the iframes, to submit into a single post that I can handle with PHP, so I know which dates are associated with which yes/no questions.
Thanks.
|

September 19th, 2005, 02:29 PM
|
 |
mod_dev_shed
|
|
Join Date: Sep 2002
Location: Atlanta, GA
|
|
|
You'd be using DHTML (Dyanmic HTML), which is a combination of CSS properties and JavaScript to modify those properties. Additionally, you'd probably end up using the innerHTML property, which will allow you to dynamically add form field inputs.
Moving this post to the JavaScript forum since that's where it's heading. I'll come up with an example at some point, but until then, search Google for those keywords in the previous paragraph.
Drop the iframe idea altogether.
|

September 19th, 2005, 03:31 PM
|
 |
CSS & JS/DOM Adept
|
|
Join Date: Jul 2004
Location: USA
|
|
|
Modifying forms with innerHTML doesn't work very well. It's better to use DOM1+ methods.
|

September 19th, 2005, 03:44 PM
|
|
Registered User
|
|
Join Date: Sep 2005
Posts: 3
Time spent in forums: 58 m 5 sec
Reputation Power: 0
|
|
|
Fantastic, thanks for the helpful replies guys. Based on both your suggestions, I've done some research and found this page:
http://www.quirksmode.org/dom/usableforms.html
It looks like it'll handle exactly what I need. In my case, when the user chooses yes on the question, I can "open" the section with the date fields and let them fill those in then.
Thanks a bunch for your help! Any further insight is still appreciated, as I haven't implemented this yet and it still may not work.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|