1 value 2 fields inserted on form update

M

Mangler

Without writing a bible on what I'm trying to do I'll see if someone
can answer a quick question.
I have a form that the user writes a value in a test field. I need to
put a hidden value that will take the same number the user inputs and
insert it in a form.

Basically,

I need ...

<input name="hdndkqty" type="hidden" id="hdndkqty" value = ??? />

the value of the hidden field to = <input name="num" type="text"
id="num2" />

Can someone help?
 
B

Bob Barrows [MVP]

Mangler said:
Without writing a bible on what I'm trying to do I'll see if someone
can answer a quick question.
I have a form that the user writes a value in a test field. I need to
put a hidden value that will take the same number the user inputs and
insert it in a form.

Basically,

I need ...

<input name="hdndkqty" type="hidden" id="hdndkqty" value = ??? />

the value of the hidden field to = <input name="num" type="text"
id="num2" />
You will need to use client-side scripting to do this, probably in the
form's onsubmit event. Something like this:

<form ... onsubmit="document.getElementById('hdndkqty').value =
document.getElementById('num2').value">

Please followup in a client-side scripting newsgroup like
m.p.scripting.jscript
 
F

Firas

I cant show you how to do it now, i will tell you the idea then i will
show you later, cause im late for college.
As Bob said, but i guess if you use functions or subs will work better,
the idea is change the submit button you use into a normal button, that
says when you click it it will run a function or a sub, in that
function/sub you say copy-paste the value from the test field into the
hidden field and then submit the form.

I will try my best to give you the code.


Best Regards
Firas S Assaad
 
F

Firas

Have a look at the code.
and then look at the address bar to see the the value in the second
field is the same as the first one.

and if you want it hidden, it will not affect anything, just change the
type to hidden

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>

<script language=javascript>
function Dupl()
{
document.form1.test2.value=document.form1.test1.value;
document.form1.submit();
}
</script>
<form name=form1 method=get>
<input type=text name=test1 >
<input type=text name=test2 >
<input type=button name=test3 value=asd onclick="javascript:Dupl();">

</form>
</BODY>
</HTML>



Hope this helps.


Best Regards
Firas S Assaad
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top