? adding name=value pairs b4 form.submit() 
Author Message
 ? adding name=value pairs b4 form.submit()

hi all,

is it possible to add name=value pairs to a form dynamically in a jscript
function right before you submit it?  here's what i'm trying to do:

function doStuff(i) // called at onClick event
{
    if (i > 0) {  /* add another name=value pair to form */  }

    // submit the form
    document.myform.submit();
    return true;

Quote:
}

if this can be done, how would i go about it?  thanks in advance!!

    - will



Fri, 07 Feb 2003 03:00:00 GMT  
 ? adding name=value pairs b4 form.submit()
<html>
<head>
<script>
function go(x) {
x.action += '&third=something%20third';
x.action += '&' + document.all.fourth.id + '=' + document.all.fourth.value;
return true;
Quote:
}

</script>
</head>
<body>
<form action='float.htm?first=something%20first&second=something%20second' method=post onsubmit='return go(this)'>
<input id=fourth type=text value='something fourth'>
<input id=fifth type=text value='something missing'>
<input type=submit>
</body>
</html>

--

Mark L. Ferguson    Reply Only in Newsgroup
marfer's notes for OE 5.0 > http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm

Quote:

> hi all,

> is it possible to add name=value pairs to a form dynamically in a jscript
> function right before you submit it?  here's what i'm trying to do:

> function doStuff(i) // called at onClick event
> {
>     if (i > 0) {  /* add another name=value pair to form */  }

>     // submit the form
>     document.myform.submit();
>     return true;
> }

> if this can be done, how would i go about it?  thanks in advance!!

>     - will



Fri, 07 Feb 2003 03:00:00 GMT  
 ? adding name=value pairs b4 form.submit()
hi mark,

neat solution, thanks!!

    - will

<html>
<head>
<script>
function go(x) {
x.action += '&third=something%20third';
x.action += '&' + document.all.fourth.id + '=' + document.all.fourth.value;
return true;

Quote:
}

</script>
</head>
<body>
<form action='float.htm?first=something%20first&second=something%20second'
method=post onsubmit='return go(this)'>
<input id=fourth type=text value='something fourth'>
<input id=fifth type=text value='something missing'>
<input type=submit>
</body>
</html>

--
link to FAQ for OE 5.5

Mark L. Ferguson    Reply Only in Newsgroup
marfer's notes for OE 5.0 >
http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm

Quote:
> hi all,

> is it possible to add name=value pairs to a form dynamically in a jscript
> function right before you submit it?  here's what i'm trying to do:

> function doStuff(i) // called at onClick event
> {
>     if (i > 0) {  /* add another name=value pair to form */  }

>     // submit the form
>     document.myform.submit();
>     return true;
> }

> if this can be done, how would i go about it?  thanks in advance!!

>     - will



Sat, 08 Feb 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Using the name-value pairs

2. Retrieve Name/Value Pairs...

3. add spaces before submitting an ASP form.

4. Grabbing the computer name when submitting form

5. Send Name/Value pairs 'invisibly' without form

6. Adding values to a registry key with a path in its name

7. JScript QueryString key/value pair assignment

8. Hidden field in form not retaining it's value after submit

9. decomposing a string into value pairs

10. Get form input field value before submit?

11. Pass values from FORM fields to another page without a SUBMIT action

12. cycle through form and add values to text boxes

 

 
Powered by phpBB® Forum Software