PDA

View Full Version : single input multiple text boxes - Help



mukhtar88
11-02-2007, 03:27 PM
Hi,

I need your help regarding this script.

I have a single drop down menu with dates for 30 days. When I select a particular date the answers are displayed in 11 text boxes simultaneously. For every day there is a different answer in all boxes.

Drop down menu =T1
Two big text boxes are T2 and T3 displaying Text.

9 small boxes are T4 to T12 displaying numbers.

Here is the body script


<Form name="Reference" style="width: 160; height: 240; text-align: center; color: #FFFFFF; border: 1px solid #000000; margin-top: 0; margin-bottom: 0; background-color: #FF9999">
<p style="margin-top: 0; margin-bottom: 0"><b><font size="2" color="#000000">Select Date</font></b></p>
<p style="margin-top: 0; margin-bottom: 0">
<SELECT name="Ti" onChange="textValue()" size="1" style="width: 140">
<option selected>select</option>
<option value="1">1-Nov-07</option>
<option value="2">2-Nov-07</option>
<option value="3">3-Nov-07</option>
<option value="4">4-Nov-07</option>
<option value="5">5-Nov-07</option>
<option value="6">6-Nov-07</option>
<option value="7">7-Nov-07</option>
<option value="8">8-Nov-07</option>
<option value="9">9-Nov-07</option>
<option value="10">10-Nov-07</option>
<option value="11">11-Nov-07</option>
<option value="12">12-Nov-07</option>
<option value="13">13-Nov-07</option>
<option value="14">14-Nov-07</option>
<option value="15">15-Nov-07</option>
<option value="16">16-Nov-07</option>
<option value="17">17-Nov-07</option>
<option value="18">18-Nov-07</option>
<option value="19">19-Nov-07</option>
<option value="20">20-Nov-07</option>
<option value="21">21-Nov-07</option>
<option value="22">22-Nov-07</option>
<option value="23">23-Nov-07</option>
<option value="24">24-Nov-07</option>
<option value="25">25-Nov-07</option>
<option value="26">26-Nov-07</option>
<option value="27">27-Nov-07</option>
<option value="28">28-Nov-07</option>
<option value="29">29-Nov-07</option>
<option value="30">30-Nov-07</option>

</select></p>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="1" face="Verdana" color="#000000">Heavenly stem of the Day</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="text" name="T2" size="20"></p>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="1" face="Verdana" color="#000000">Earthly branch of the Day</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="text" name="T3" size="20"></p>
<p style="line-height: 150%; margin-top: 0; margin-bottom: 0">
<font size="1" face="Verdana" color="#000000">Flying star of the Day</font></p>
<p style="margin-top: 0; margin-bottom: 0">

<input type="text" name="T4" size="20" style="width: 25">
<input type="text" name="T5" size="20" style="width: 25">
<input type="text" name="T6" size="20" style="width: 25"></p>
<p style="margin-top: 0; margin-bottom: 0">

<input type="text" name="T7" size="20" style="width: 25">
<input type="text" name="T8" size="20" style="width: 25">
<input type="text" name="T9" size="20" style="width: 25"></p>
<p style="margin-top: 0; margin-bottom: 0">

<input type="text" name="T10" size="20" style="width: 25">
<input type="text" name="T11" size="20" style="width: 25">
<input type="text" name="T12" size="20" style="width: 25"></p>
</form>

I do not know how to connect all the text boxes to the single drop down
menu.

I mean the head script.

Please help.

Regards,
Mukhtar
http://Globalfreelinks.bravehost.com
(Free website directory - submit your site)

jc_gmk
11-05-2007, 09:46 AM
you could do this with a bit of javascipt and PHP

e.g.



<select name='Ti' onchange="reload(this.form)">




function reload(form)
{
var val=form.ti.options[form.ti.options.selectedIndex].value;
self.location='samepage.php?date=' + val ;
}




<?php
$date = $_GET['date'];

switch ($date)
{
case 1:
$t4 = ' value="Text to go in T4 box if 1-Nov is selected"';
$t5 = ' value="Text to go in T5 box if 1-Nov is selected"';
break;
case 2:
$t4 = ' value="Text to go in T4 box if 2-Nov is selected"';
$t5 = ' value="Text to go in T5 box if 2-Nov is selected"';
break;
}
?>
<input type="text" name="T4" size="20" style="width: 25"<?php print $t4; ?>>
<input type="text" name="T5" size="20" style="width: 25"<?php print $t5; ?>>

profug0
11-06-2007, 07:49 PM
It all depends what's in your 'textValue()' function.

This is how you would access a specific text box inside that function:


var T1 = document.getElementById('T1');
T1.value = 'whatever I want';

Based on this, you could do:


function textValue(elem) // substitute 'this' for 'elem' in the HTML
{
for (i = 0; i < 12; i++)
{
var textbox = document.getElementById('T' + i);
textbox.value = 'something';
}
}

Is this what you mean?

mukhtar88
11-11-2007, 07:52 AM
Hi,

I am unable to understand the answer as I am not good at javascript or C language.

Previously I had uploaded a script which used to give single output from a dropdown menu which had text inside it. Here i wish to use date in the drop down menu and when the date is changed the answers are changed in all the Text boxes from T2 to T12. Please see the previous script as it was easy for me.


<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 2</title>
</head>

<body>
<script type="text/javascript">
function setNumParticipants( inputId, outputId )
{
var p = document.getElementById( inputId );
var t = document.getElementById( outputId );
if(!p ) return;
if(!t ) return;
switch (p.value)
{
case "0":
// Set total value:
t.value = "";
// Add your function to show/hide other inputs here
break;
case "1":
// Set total value:
t.value = "Rat and Ox";
// Add your function to show/hide other inputs here
break;
case "2":
t.value = "Tiger and Rabbit";
// Add your function to show/hide other inputs here
break;
}
}
</script>

<select id="numParticipants" onchange="setNumParticipants('numParticipants','total');" style="border: 1px solid rgb(0, 0, 0); width: 140px; font-family: Verdana; font-size: 8pt; vertical-align: middle; background-color: rgb(255, 204, 204);">
<option selected value="1">1st November 2007</option>
<option value="2">2nd November 2007</option>
</select> </p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Arial">
Heavenly stem of the day</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="text" name="total" size="20" id="total"> </p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2">Earthly Branch of
the day</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="text" name="total2" size="20" id="total2"></p>
<p style="margin-top: 0; margin-bottom: 0"><font size="2" face="Arial">Flying
stars of the day</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="text" name="T2" size="3" style="width: 25" id="T2">
<input type="text" name="T3" size="20" style="width: 25" id="T3">
<input type="text" name="T4" size="20" style="width: 25">
<font face="Arial" size="2">South in</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="text" name="T5" size="20" style="width: 25">
<input type="text" name="T6" size="20" style="width: 25">
<input type="text" name="T7" size="20" style="width: 25">
<font face="Arial" size="2">center</font></p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="text" name="T8" size="20" style="width: 25">
<input type="text" name="T9" size="20" style="width: 25">
<input type="text" name="T10" size="20" style="width: 25">
<font face="Arial" size="2">top</font></p>
</form>

</body>

</html>

I have a excel file at this link please download as it is the same program which I would like to convert for web page.
click here for download (http://www.orbitfiles.com/download/id2184630798.html)

Thank you very much for the help.

Regards,
Mukhtar

Removed ad link

mukhtar88
11-13-2007, 10:31 AM
:confused:

mukhtar88
11-22-2007, 10:37 AM
:confused: