Click to See Complete Forum and Search --> : Combining the contents of 2 inputboxes into a third


kahlua17
11-18-2003, 03:50 PM
I was wondering how it would be possible to have 2 textboxes where someone can enter their information and have a third box that displays the combined results.

For example: The first 2 boxes would be text boxes, and the third would be hidden.


BOX #1 : 2003
BOX #2 : 124637

BOX #3 : 2003124637

This is essentially to be used as a means of creating a unique number based on 2 entries. In my case, it will be User ID and a Date/Time Stamp in the first 2 boxes and the result in the third box.

Thanks!

Charles
11-18-2003, 03:54 PM
But how is this going to work for those who do not use JavaScript?

kahlua17
11-18-2003, 03:57 PM
^^ I don't know. I know JavaScript will be required to do it... I just don't know how to do it. :confused:

Charles
11-18-2003, 04:02 PM
Originally posted by kahlua17
^^ I don't know. I know JavaScript will be required to do it... I just don't know how to do it. :confused: You'll have to use some sort of server side script then. What do you have available?

kahlua17
11-19-2003, 08:15 AM
You'll have to use some sort of server side script then. What do you have available?

I am using MYSQL.

TheBearMay
11-19-2003, 09:15 AM
Assuming javascript is available it's relatively simple.


...
<script>
function CombineText(){
alert(T1.value);
T3.value=T1.value+T2.value;
}
</script>
...
<input type='text' name='T1' onchange='CombineText();'>
<input type='text' name='T2' onchange='CombineText();'>
<input type='text' name='T3' readonly>
...

kahlua17
11-19-2003, 09:25 AM
Worked like a charm!! :D Thanks a lot!!