Submitting only CHANGED text boxes

Discussion in 'Javascript' started by rked@att.net, May 10, 2005.

  1. Guest

    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!
    , May 10, 2005
    #1
    1. Advertising

  2. RobG Guest

    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;

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

    }
    </script>



    --
    Rob
    RobG, May 11, 2005
    #2
    1. Advertising

  3. Guest

    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
    , May 11, 2005
    #3
  4. RobG Guest

    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
    RobG, May 12, 2005
    #4
  5. Mick White Guest

    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.firstChild
    while(z.firstChild)z=z.firstChild;
    description=z.data

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

    Mick
    Mick White, May 12, 2005
    #5
  6. Lee Guest

    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.
    Lee, May 12, 2005
    #6
  7. Mick White Guest

    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
    Mick White, May 12, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Johnny
    Replies:
    1
    Views:
    367
    Chris Jackson
    Nov 25, 2003
  2. Julie

    Text boxes and read-only text

    Julie, May 12, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,078
    Julie
    May 12, 2004
  3. Replies:
    1
    Views:
    679
    Rosanne
    Oct 11, 2005
  4. Stefan Mueller
    Replies:
    5
    Views:
    12,377
    jamesxa
    Jun 16, 2009
  5. mxbrunet
    Replies:
    1
    Views:
    210
Loading...

Share This Page