By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,478 Members | 1,086 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,478 IT Pros & Developers. It's quick & easy.

Changing form's field input type

P: n/a
Hi all,
We have the form which uses checkboxes for several fields and the target
action points to outside webservice. Unfortunatelly they do not support
checkboxes. How to pass it as a radio buttons or pull down select box with
Yes/No options for example (which they support) using still checkboxes as an
input entry.
Thank you for any hint,
emanuel
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies

P: n/a
On Mon, 8 Mar 2004 10:12:37 -0500, "Emanuel Marciniak"
<em********@patientcare.com> wrote:
Hi all,
We have the form which uses checkboxes for several fields and the target
action points to outside webservice. Unfortunatelly they do not support
checkboxes. How to pass it as a radio buttons or pull down select box with
Yes/No options for example (which they support) using still checkboxes as an
input entry.
Thank you for any hint,
emanuel


Server-side there are no such things as "checkboxes" or "radio
buttons". All <input>s submit themselves as name/value pairs. A
server-side script cannot determine what type of form element was
used.

If you want a checkbox to submit the value "yes", use:
<input type='checkbox' name='whatever' value='yes'>

Checkboxes don't submit a value if they're unselected. This may be the
problem you're having. If it is, then other than using Javascript
client-side (not recommended), I can't see a way around it.

--
David ( @priz.co.uk )
Jul 17 '05 #2

P: n/a
David Mackenzie wrote:

On Mon, 8 Mar 2004 10:12:37 -0500, "Emanuel Marciniak"
<em********@patientcare.com> wrote:
Hi all,
We have the form which uses checkboxes for several fields and the target
action points to outside webservice. Unfortunatelly they do not support
checkboxes. How to pass it as a radio buttons or pull down select box with
Yes/No options for example (which they support) using still checkboxes as an
input entry.
Thank you for any hint,
emanuel


Server-side there are no such things as "checkboxes" or "radio
buttons". All <input>s submit themselves as name/value pairs. A
server-side script cannot determine what type of form element was
used.

If you want a checkbox to submit the value "yes", use:
<input type='checkbox' name='whatever' value='yes'>

Checkboxes don't submit a value if they're unselected. This may be the
problem you're having. If it is, then other than using Javascript
client-side (not recommended), I can't see a way around it.


Actually, I wonder if he could make the page submit to itself, make sure there
are variable="no"'s whereever there aren't variable="yes"'s upon submit, then
redirect the page to the outside webservice. This would take a bit longer and
probably wouldn't work for POST (at least without re-prompting the user about
resending the data).

Or, he could make his custom form, submit it to his server and have the server
submit it to the outside web service. On completion he could send a
success/error message to the user. This would take even longer, though, and
could cause problems if the outside web service logs/blocks IPs to prevent
spamming, etc.

Both of these options assume he has access to PHP, which may be an incorrect
assumption.

Regards,
Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #3

P: n/a
Dave, Shawn - thank you for your comments.
Yes I do have an access to PHP. I think I will play with Shawn's first
option. (resubmitting will be just another form with fields filled-up with
user's original entry - if ok then submit to webservice if not then refresh
an original form). PHP if statement will check value/name of 'checkbox' and
submit corresponding value/name of 'radio button'.
thank you
emanuel

"Shawn Wilson" <sh***@glassgiant.com> wrote in message
news:40***************@glassgiant.com...
David Mackenzie wrote:

On Mon, 8 Mar 2004 10:12:37 -0500, "Emanuel Marciniak"
<em********@patientcare.com> wrote:
Hi all,
We have the form which uses checkboxes for several fields and the targetaction points to outside webservice. Unfortunatelly they do not support
checkboxes. How to pass it as a radio buttons or pull down select box withYes/No options for example (which they support) using still checkboxes as aninput entry.
Thank you for any hint,
emanuel
Server-side there are no such things as "checkboxes" or "radio
buttons". All <input>s submit themselves as name/value pairs. A
server-side script cannot determine what type of form element was
used.

If you want a checkbox to submit the value "yes", use:
<input type='checkbox' name='whatever' value='yes'>

Checkboxes don't submit a value if they're unselected. This may be the
problem you're having. If it is, then other than using Javascript
client-side (not recommended), I can't see a way around it.


Actually, I wonder if he could make the page submit to itself, make sure

there are variable="no"'s whereever there aren't variable="yes"'s upon submit, then redirect the page to the outside webservice. This would take a bit longer and probably wouldn't work for POST (at least without re-prompting the user about resending the data).

Or, he could make his custom form, submit it to his server and have the server submit it to the outside web service. On completion he could send a
success/error message to the user. This would take even longer, though, and could cause problems if the outside web service logs/blocks IPs to prevent
spamming, etc.

Both of these options assume he has access to PHP, which may be an incorrect assumption.

Regards,
Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.