Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / April 2005

Tip: Looking for answers? Try searching our database.

get "all" HTML form parameters in servlet

Thread view: 
spb - 31 Mar 2005 07:56 GMT
I have an HTML form which on submission I need to insert into the
database. I am using a servlet and using the get parameter names and
values. However, if none of the options of a checkbox are selected then
I do not even get the parameter name. I definitely need to know the
parameter names even if they are not selected. Also, if possible I want
to be able to get all the checkbox values irrespective of whether they
were checked ot unchecked (maybe with some check flag or some way).
I am stuck and need some help asap. Appreciate any suggestions or help.

Thanks.
kaeli - 31 Mar 2005 15:05 GMT
> I have an HTML form which on submission I need to insert into the
> database. I am using a servlet and using the get parameter names and
[quoted text clipped - 4 lines]
> were checked ot unchecked (maybe with some check flag or some way).
> I am stuck and need some help asap. Appreciate any suggestions or help.

This is normal form behavior that has nothing to do with java. You would run
into this with any server-side handler. HTML specs state that "unsuccessful"
controls do not submit to the server. An unmarked checkbox is considered
unsuccessful.

http://www.w3.org/TR/html4/interact/forms.html#checkbox
"Checkboxes (and radio buttons) are on/off switches that may be toggled by
the user. A switch is "on" when the control element's checked attribute is
set. When a form is submitted, only "on" checkbox controls can become
successful."

If you need to pass all controls regardless of success, you will have to use
hidden form fields (which will always be passed) or some other work-around.

Signature

--
~kaeli~
Do cemetery workers prefer the graveyard shift?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

HalcyonWild - 01 Apr 2005 09:16 GMT
Is it possible for you to pass whatever you need as hidden parameters,
on click of submit button.

Like for example,
document.myform.hidden1.value = document.myform.checkbox1.name;

I guess this will not work if what checkboxes you want to show on the
screen is dynamic in nature. (Eg. for a less privileged user, do not
show some checkbox). I think you can work around that, by generating
your javascript in a jsp if block.
Thanx,
SatishMotwani.

> I have an HTML form which on submission I need to insert into the
> database. I am using a servlet and using the get parameter names and
[quoted text clipped - 6 lines]
>
> Thanks.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.