Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > HTML Submit Blank Form Fields

Reply
Thread Tools

HTML Submit Blank Form Fields

 
 
kagreen2002@yahoo.com
Guest
Posts: n/a
 
      04-03-2008
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
 
 
 
 
Jonathan N. Little
Guest
Posts: n/a
 
      04-03-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> 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
 
 
 
 
Adrienne Boswell
Guest
Posts: n/a
 
      04-04-2008
Gazing into my crystal ball I observed (E-Mail Removed) writing in
news:(E-Mail Removed):

> 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

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
submit 1 form to 2 servers or 2 forms to 2 server (1 form each) on 1 submit abansal.itp@gmail.com Javascript 3 06-23-2007 07:29 AM
document.form.submit() doesn't work for large form fields alan_atwood Javascript 2 03-02-2006 04:25 PM
<form>...</form> - how to supress blank space after </form> in IE? rob c Javascript 4 12-30-2005 06:10 PM
Ruby CGI and blank form fields Matthew Margolis Ruby 2 01-30-2005 12:16 PM
STRUTS-<html:submit> -Hitting enter key does not submit the form Megha Vishwanath Javascript 3 07-20-2004 05:45 AM



Advertisments