Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Submitting only CHANGED text boxes

Reply
Thread Tools

Submitting only CHANGED text boxes

 
 
rked@att.net
Guest
Posts: n/a
 
      05-10-2005
I have an order form with about a hundred textboxes saying 0.
People change the zero to something else to tell quantity of field.
I am submitting page via asp and cdo.

Is there a function that detects changed text boxes and will only have
those submitted?

Here is address of page.

http://www.marioncountyfl.org/emsasupplies.htm

I dont want all the non-ordered items showing up in submissal. Thanks!

 
Reply With Quote
 
 
 
 
RobG
Guest
Posts: n/a
 
      05-11-2005
wrote:
> I have an order form with about a hundred textboxes saying 0.
> People change the zero to something else to tell quantity of field.
> I am submitting page via asp and cdo.
>
> Is there a function that detects changed text boxes and will only have
> those submitted?
>
> Here is address of page.
>
> http://www.marioncountyfl.org/emsasupplies.htm
>
> I dont want all the non-ordered items showing up in submissal. Thanks!
>


Create an onsubmit function that disables all the text inputs that have
a value of '0' - disabled elements are not successful and should not be
submitted by the browser.

Any browser with JavaScript disabled (or without javascript at all)
will submit all the fields regardless. A sample script that will also
disable any empty text element (value = '') is below:

<form name="strBody" onsubmit="disableZeros(this);" ... >
...
</form>

<script type="text/javascript">
function disableZeros(f){
var els = f.elements;
var i=0;
var el = els[i];

do {
if ('text'==el.type && 0==el.value) el.disabled = true;
} while ( el = els[++i] )

}
</script>



--
Rob
 
Reply With Quote
 
 
 
 
rked@att.net
Guest
Posts: n/a
 
      05-11-2005
Thankyou soo much for replying. I works nicely.
Alas, I have run into another condundrum.
I am able to request.form value of field > 0 but is there a way to also
write the field associated with the value submitted? Because all I get
is a list of numbers and not the field names associted with those
values. So instead of
1
2
4
3

I would like

FastPatches (Adult) - 1
FastPatches (Pediatric) - 2
Patient Electrodes (pack) - 4
Pediatric Electrodes - 3

In essence, response.write only those items that have been submitted or
obtained via request.form... i hope this makes sense

 
Reply With Quote
 
RobG
Guest
Posts: n/a
 
      05-11-2005
wrote:
> Thankyou soo much for replying. I works nicely.
> Alas, I have run into another condundrum.
> I am able to request.form value of field > 0 but is there a way to also
> write the field associated with the value submitted? Because all I get
> is a list of numbers and not the field names associted with those
> values. So instead of
> 1
> 2
> 4
> 3
>
> I would like
>
> FastPatches (Adult) - 1
> FastPatches (Pediatric) - 2
> Patient Electrodes (pack) - 4
> Pediatric Electrodes - 3
>
> In essence, response.write only those items that have been submitted or
> obtained via request.form... i hope this makes sense
>


At at guess you're talking ASP here? If so, you are more likely to get
a suitable answer in an ASP or server scripting/programming forum.

--
Rob
 
Reply With Quote
 
Mick White
Guest
Posts: n/a
 
      05-12-2005
wrote:
[snip] So instead of
> 1
> 2
> 4
> 3
>
> I would like
>
> FastPatches (Adult) - 1
> FastPatches (Pediatric) - 2
> Patient Electrodes (pack) - 4
> Pediatric Electrodes - 3
>
> In essence, response.write only those items that have been submitted or
> obtained via request.form... i hope this makes sense


In js, you're looking for:
z= TEXTFIELDOBJECT.parentNode.previousSibling.firstCh ild
while(z.firstChild)z=z.firstChild;
description=z.data

Pass this along with the qty ordered, store it in a hidden field.

Mick

 
Reply With Quote
 
Lee
Guest
Posts: n/a
 
      05-12-2005
said:
>
>Thankyou soo much for replying. I works nicely.
>Alas, I have run into another condundrum.
>I am able to request.form value of field > 0 but is there a way to also
>write the field associated with the value submitted?


It's a bad idea to make your form submission dependent on client-side
Javascript. Massage the form data however you like on the server side
in your ASP code.

 
Reply With Quote
 
Mick White
Guest
Posts: n/a
 
      05-12-2005
Lee wrote:
....
>
> It's a bad idea to make your form submission dependent on client-side
> Javascript. Massage the form data however you like on the server side
> in your ASP code.
>

I agree that SS processing is crucial. Why not simply give form
controls meaningful names?
Mick
 
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
Help: displayed characters all changed to graphic boxes! Edward Feustel Windows 64bit 0 04-30-2010 10:14 AM
Space between input boxes and selection boxes is not the same in Internet Explorer Stefan Mueller HTML 5 06-16-2009 02:06 PM
xmlDocument.Save "&#10;" getting changed changed to "&amp;#10" st@jpa.co.jp ASP .Net 1 10-11-2005 01:30 PM
Text boxes and read-only text Julie ASP .Net 2 05-12-2004 06:04 AM
Validate Changed Data Before Submitting Johnny ASP .Net 1 11-25-2003 07:40 PM



Advertisments