HighDots Forums  

HTML Submit Blank Form Fields

alt.html alt.html


Discuss HTML Submit Blank Form Fields in the alt.html forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kagreen2002@yahoo.com
 
Posts: n/a

Default HTML Submit Blank Form Fields - 04-03-2008 , 10:19 AM






I have a form that updates a database table row. The form sends back
all fields that are filled in, and my CGI updates those fields. My
problem is if a user blanks out a field, that field is not sent
back, ,and so the CGI does not update the field to blank.

Is there a way for the form to submit all fields regardless of whether
data is entered in them?

Thanks.

Reply With Quote
  #2  
Old   
Jonathan N. Little
 
Posts: n/a

Default Re: HTML Submit Blank Form Fields - 04-03-2008 , 02:39 PM






kagreen2002 (AT) yahoo (DOT) com wrote:
Quote:
I have a form that updates a database table row. The form sends back
all fields that are filled in, and my CGI updates those fields. My
problem is if a user blanks out a field, that field is not sent
back, ,and so the CGI does not update the field to blank.

Is there a way for the form to submit all fields regardless of whether
data is entered in them?
No, but what you can do is have your CGI script have a list of
*expected* fields and compare to to the list of *received* field and any
ones missing use null value, i.e., you preset them with an acceptable
value. Your script should be restricted to only those field names that
you have predefined. Know exactly what type and quantity of data is
permissible. Check it before using such data and discard or deal with it
appropriately if it does not conform. If you don't you most likely have
an insecure and possibly dangerous script.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


Reply With Quote
  #3  
Old   
Adrienne Boswell
 
Posts: n/a

Default Re: HTML Submit Blank Form Fields - 04-03-2008 , 08:34 PM



Gazing into my crystal ball I observed kagreen2002 (AT) yahoo (DOT) com writing in
news:01298e4d-4c67-4d6a-ac47-e102f03e0bc9 (AT) u69g2000hse (DOT) googlegroups.com:

Quote:
I have a form that updates a database table row. The form sends back
all fields that are filled in, and my CGI updates those fields. My
problem is if a user blanks out a field, that field is not sent
back, ,and so the CGI does not update the field to blank.

Is there a way for the form to submit all fields regardless of whether
data is entered in them?

Thanks.
If you are using input type text, you should receive an empty value upon
submission. The only exceptions are radio, checkbox and select.
However, if you specify a default value, you should get those as well,
eg:
<input type="radio" value="" name="field" checked> Default
<input type="radio" value="a" name="field">A
<input type="checkbox" value="" name="field" checked> Default
<input type="checkbox" value="a" name="field">A
<select name="field">
<option value="" selected>Default</option>
<option value="a">A</option>
</select>

Again, as Jonathan said, your server side script should check these
fields before sending anything to the database.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.