Preloading table cells
Posted: Fri Jul 01, 2005 2:10 pm
Hello,
I have a big long form that my users have to fill out and would like to ease their burden.
I'm using several lines of repetitious code that collects info about the appliances used in the user's home, including wattage, quantity, etc. The data in many of the cells is predictable and it would be a time saver if I could preload that data in the cell when the user moves to that cell. For example, I'd like to have a blank form, but when the user puts the cursor into the "dishwasher wattage" cell, it would automatically fill with the value "300". This value could then be changed by the user if it's incorrect.
If that's not possible, I'd like for the values to already be in the cells when the form is loaded, and have the cell data editable by the user.
Below is a segment of the code (the start of the form and the first few rows of input cells)...
<html>
<?
FORM ACTION="loadCalc.php" METHOD="post">
<TABLE BORDER="2" FRAME="box" RULES="rows" BGCOLOR="#EEEEEE">
<CAPTION><h2>LOAD CALCULATOR</h2></CAPTION>
<COLGROUP align="left">
<COLGROUP align="center">
<COLGROUP align="center">
<COLGROUP align="center">
<COLGROUP align="center">
<TR><TH><CENTER>Appliance Name</CENTER></TH>
<TH width=100>Quantity</TH>
<TH width=100>Watts</TH>
<TH width=100>hrs/day (Summer)</TH>
<TH width=100>hrs/day (Winter)</TH></TR>
<TBODY>
<TR><TD>Refrigerator</TD>
<TD><INPUT type="text" name="numFridges" value="" SIZE=4></TD>
<TD><INPUT type="text" name="fridgeWatts" value="" SIZE=4></TD>
<TD><INPUT type="text" name="summ_0" value=""SIZE=4></TD>
<TD><INPUT type="text" name="wint_0" value="" SIZE=4></TD></TR>
<TR><TD>Light Bulbs</TD>
<TD><INPUT type="text" name="numLights" value="" SIZE=4></TD>
<TD><INPUT type="text" name="lightWatts" value="" SIZE=4></TD>
<TD><INPUT type="text" name="summ_1" value="" SIZE=4></TD>
<TD><INPUT type="text" name="wint_1" value="" SIZE=4></TD></TR>
<TR><TD>Computer</TD>
<TD><INPUT type="text" name="numComps" value="" SIZE=4></TD>
<TD><INPUT type="text" name="compWatts" value="" SIZE=4></TD>
<TD><INPUT type="text" name="summ_2" value="" SIZE=4></TD>
<TD><INPUT type="text" name="wint_2" value="" SIZE=4></TD></TR>
Thanks, any help would be appreciated.
I have a big long form that my users have to fill out and would like to ease their burden.
I'm using several lines of repetitious code that collects info about the appliances used in the user's home, including wattage, quantity, etc. The data in many of the cells is predictable and it would be a time saver if I could preload that data in the cell when the user moves to that cell. For example, I'd like to have a blank form, but when the user puts the cursor into the "dishwasher wattage" cell, it would automatically fill with the value "300". This value could then be changed by the user if it's incorrect.
If that's not possible, I'd like for the values to already be in the cells when the form is loaded, and have the cell data editable by the user.
Below is a segment of the code (the start of the form and the first few rows of input cells)...
<html>
<?
FORM ACTION="loadCalc.php" METHOD="post">
<TABLE BORDER="2" FRAME="box" RULES="rows" BGCOLOR="#EEEEEE">
<CAPTION><h2>LOAD CALCULATOR</h2></CAPTION>
<COLGROUP align="left">
<COLGROUP align="center">
<COLGROUP align="center">
<COLGROUP align="center">
<COLGROUP align="center">
<TR><TH><CENTER>Appliance Name</CENTER></TH>
<TH width=100>Quantity</TH>
<TH width=100>Watts</TH>
<TH width=100>hrs/day (Summer)</TH>
<TH width=100>hrs/day (Winter)</TH></TR>
<TBODY>
<TR><TD>Refrigerator</TD>
<TD><INPUT type="text" name="numFridges" value="" SIZE=4></TD>
<TD><INPUT type="text" name="fridgeWatts" value="" SIZE=4></TD>
<TD><INPUT type="text" name="summ_0" value=""SIZE=4></TD>
<TD><INPUT type="text" name="wint_0" value="" SIZE=4></TD></TR>
<TR><TD>Light Bulbs</TD>
<TD><INPUT type="text" name="numLights" value="" SIZE=4></TD>
<TD><INPUT type="text" name="lightWatts" value="" SIZE=4></TD>
<TD><INPUT type="text" name="summ_1" value="" SIZE=4></TD>
<TD><INPUT type="text" name="wint_1" value="" SIZE=4></TD></TR>
<TR><TD>Computer</TD>
<TD><INPUT type="text" name="numComps" value="" SIZE=4></TD>
<TD><INPUT type="text" name="compWatts" value="" SIZE=4></TD>
<TD><INPUT type="text" name="summ_2" value="" SIZE=4></TD>
<TD><INPUT type="text" name="wint_2" value="" SIZE=4></TD></TR>
Thanks, any help would be appreciated.