473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Javascript - Button that adds text to the end of a form field ??

user404
I'm trying to add a button that will update the value of a form field with some text followed by the contents of another field. Here's what I got:

[html]
<form action="<?php echo ($_SERVER['PHP_SELF']); ?>" method="post" name="foo">

{...snip...}

<p>
<b>Item to list on printout:</b>
<input type="text" name="item" size=40 maxlength=80 /></p>
<p><input type="checkbox" name="fl" value="1" CHECKED />
Your order is currently
<input type="text" name="status" size="30" maxlength="60" value="backordered" style="background-color:#ebecfe" />

<input type="button" name="bar" value="Held up waiting on" onClick="document.foo.status.value='held up waiting on' " />

[/html]

I'd like the msg on line 12 to be: 'held up waiting on' . document.foo.item.value
but I don't know how to do that in javascript in a onClick setting.

Thanks in advance,

- Dave (user404)
Jun 18 '07 #1
1 1318
epots9
1,351 Expert 1GB
I'm trying to add a button that will update the value of a form field with some text followed by the contents of another field. Here's what I got:

[html]
<form action="<?php echo ($_SERVER['PHP_SELF']); ?>" method="post" name="foo">

{...snip...}

<p>
<b>Item to list on printout:</b>
<input type="text" name="item" size=40 maxlength=80 /></p>
<p><input type="checkbox" name="fl" value="1" CHECKED />
Your order is currently
<input type="text" name="status" size="30" maxlength="60" value="backordered" style="background-color:#ebecfe" />

<input type="button" name="bar" value="Held up waiting on" onClick="document.foo.status.value='held up waiting on' " />

[/html]

I'd like the msg on line 12 to be: 'held up waiting on' . document.foo.item.value
but I don't know how to do that in javascript in a onClick setting.

Thanks in advance,

- Dave (user404)
try this:
Expand|Select|Wrap|Line Numbers
  1. document.foo.status.value='held up waiting on ' + document.foo.item.value;
  2.  
good luck
Jun 18 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.