List Info

Thread: assigning value from one field to another




assigning value from one field to another
country flaguser name
United States
2008-03-19 23:25:37

Hi,

I am trying to assign the value of one field to a string and then
assign that string as the value of a second field. This is what I've
tried which doesn't work. Can someone tell me what I'm doing wrong?

Thanks

David

<html>
<head>
<script language=&quot;javascript">

function CreatOrderString(form) {
var amount = form.chargeamount.value ;
form.orderstring.value = "1~Dummy Order String~&quot; + amount +"~1~N~||" ;
form.orderstring.focus();
return true;
}
</script>

</head&gt;
<body>
&lt;form>
<input type=text name=chargeamount size=15 onChange=&quot;return
CreateOrderString() ;" >
<;input type=text name=orderstring size=60 value=&quot;">;
<input type=submit value=submit>
&lt;/form>

</body>
</html&gt;

__._,_.___
.

__,_._,___
Re: assigning value from one field to another
country flaguser name
United States
2008-03-21 08:26:17

Just a quick glance ...

CreateOrderString requires a parameter. You haven't provided one in the
call.

Seeing it's the form that's doing the call, the parameter in the call can
just be "this" (without the quotes).

Regards, Dave S

----- Original Message -----
From: "David" < dgresser%40sbcglobal.net">dgressersbcglobal.net>
To: < JavaScript_Official%40yahoogroups.com">JavaScript_Officialyahoogroups.com>
Sent: Thursday, March 20, 2008 3:25 PM
Subject: [JavaScript] assigning value from one field to another

> Hi,
>
> I am trying to assign the value of one field to a string and then
>; assign that string as the value of a second field. This is what I've
>; tried which doesn't work. Can someone tell me what I'm doing wrong?
&gt;
> Thanks
&gt;
> David
&gt;
> <html&gt;
> <head&gt;
> <script language=&quot;javascript">
>
> function CreatOrderString(form) {
> var amount = form.chargeamount.value ;
> form.orderstring.value = "1~Dummy Order String~&quot; + amount +"~1~N~||" ;
> form.orderstring.focus();
>; return true;
&gt; }
> </script>
>;
> </head&gt;
> <body&gt;
> <form&gt;
> <input type=text name=chargeamount size=15 onChange=&quot;return
> CreateOrderString() ;" >
>; <input type=text name=orderstring size=60 value=&quot;">;
> <input type=submit value=submit>
&gt; </form&gt;
>
>
&gt; </body&gt;
> </html&gt;
>
>
&gt; ========================================================================
> Groups related to JavaScript_Official
> ========================================================================
>
> Java_Official (1349 common members)
> http://groups.yahoo.com/group/Java_Official?v=1&amp;t=ipt&;ch=email&amp;pub=groups&slk=aftr0&amp;sec=recg
> Programming Languages/Java: Java Official Group is created for the
> following t...
>;
> VisualBasic_Official (491 common members)
> http://groups.yahoo.com/group/VisualBasic_Official?v=1&t=ipt&ch=email&pub=groups&slk=aftr1&sec=recg
> Programming Languages/Visual Basic: Visual Basic Official Group is created
> for the fol...
&gt;
> c-prog (375 common members)
> http://groups.yahoo.com/group/c-prog?v=1&t=ipt&amp;ch=email&pub=groups&;slk=aftr2&sec=recg
> Programming Languages/C and C++: This is a C/C++ programming mailing list
> for both ...
>
> SQL_beginners (308 common members)
> http://groups.yahoo.com/group/SQL_beginners?v=1&amp;t=ipt&;ch=email&amp;pub=groups&slk=aftr3&amp;sec=recg
> Programming Languages/SQL: This group is meant for people who have little
> kno...
&gt;
> j2eelist (295 common members)
> http://groups.yahoo.com/group/j2eelist?v=1&t=ipt&ch=email&pub=groups&amp;slk=aftr4&sec=recg
&gt; Programming Languages/Java: Iranian J2EE Developers Group This group is
> founde...
>
&gt;
> ------------------------------------
&gt;
> Visit http://aiaiai.com for more groups to joinYahoo! Groups Links
&gt;
>
>

__._,_.___
.

__,_._,___
Re: assigning value from one field to another
user name
2008-03-20 13:29:56

Try placing your tag attributes in either single or double quotes and giving them an "id&quot; field:
<input type='text' id='chargeamount' name='chargeamount' size='15' onChange=&quot;return CreateOrderString();" />
<input type='text' id='orderstring' name='orderstring' size='60' value=&quot;"/&gt;

Then try something like:
var amount = document.getElementById('chargeamount').value;
document.getElementById('orderstring').value = amount;

Alligator_666

David < dgresser%40sbcglobal.net">dgressersbcglobal.net> wrote: Hi,

I am trying to assign the value of one field to a string and then
assign that string as the value of a second field. This is what I've
tried which doesn't work. Can someone tell me what I'm doing wrong?

Thanks

David

<html&gt;
<head&gt;
<script language=&quot;javascript">

function CreatOrderString(form) {
var amount = form.chargeamount.value ;
form.orderstring.value = "1~Dummy Order String~&quot; + amount +"~1~N~||" ;
form.orderstring.focus();
return true;
}
</script>

</head&gt;
<body&gt;
<form&gt;
<input type=text name=chargeamount size=15 onChange=&quot;return
CreateOrderString() ;" >
<input type=text name=orderstring size=60 value=&quot;">;
<input type=submit value=submit>
</form&gt;

</body&gt;
</html&gt;





---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
Re: assigning value from one field to another
country flaguser name
United States
2008-03-25 13:29:43

Hi David,

I have corrected the code to work, please check it once and let me know if u
have any problems.

<html>
&lt;head>
<script language=&quot;javascript">
function CreateOrderString(form) {
var amount = document.OrderForm.chargeamount.value ;
document.OrderForm.orderstring.value = "1~Dummy Order String~&quot; + amount
+"~1~N~||" ;
document.OrderForm.orderstring.focus();
return true;
}
</script>
&lt;/head>
<body>
<form name=";OrderForm&quot;>
<input type=";text" name=";chargeamount" size=";15" onChange=&quot;return
CreateOrderString(this)" >
<;input type=";text" name=";orderstring" size=";60" value=&quot;">;
<input type=";submit&quot; value=&quot;submit&quot;>
</form&gt;
</body>
&lt;/html>;

Regards,
Venkat

On Wed, Mar 19, 2008 at 9:25 PM, David < dgresser%40sbcglobal.net">dgressersbcglobal.net> wrote:

> Hi,
>
> I am trying to assign the value of one field to a string and then
>; assign that string as the value of a second field. This is what I've
>; tried which doesn't work. Can someone tell me what I'm doing wrong?
&gt;
> Thanks
&gt;
> David
&gt;
> <html&gt;
> <head&gt;
> <script language=&quot;javascript">
>
> function CreatOrderString(form) {
> var amount = form.chargeamount.value ;
> form.orderstring.value = "1~Dummy Order String~&quot; + amount +"~1~N~||" ;
> form.orderstring.focus();
>; return true;
&gt; }
> </script>
>;
> </head&gt;
> <body&gt;
> <form&gt;
> <input type=text name=chargeamount size=15 onChange=&quot;return
> CreateOrderString() ;" >
>; <input type=text name=orderstring size=60 value=&quot;">;
> <input type=submit value=submit>
&gt; </form&gt;
>
> </body&gt;
> </html&gt;
>
>
>

[Non-text portions of this message have been removed]

__._,_.___
.

__,_._,___
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )