By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,636 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,636 IT Pros & Developers. It's quick & easy.

Help with disable/enable script for multible text fields

P: 3
Hello, Thank you in advance for any help, it will be most appreciated!

I need to be able to disable several text fields, until the user enters a value in a certain text field. Once they enter a number, the text field items would be enabled.

It's an order form, where they can pick and choose from several items to make up a case, they must enter how many cases first before being able to choose form the list of items. The list of items are listed in text fields so that they can type in how many of each of the items they wish to choose. Each item has a different name.

(This script is needed soon but I the calcuting stuff I can wait on)

I would also (love) need within this form for the script to somehow calculate from the number in the "number of cases" to allow the user to only be able to choose that certain amount. say like the case amount is 24 and they desire 2 cases, then the number of cases would determine how many choices they can make from the list. Is this possible?
(like I stated, this part I can live without for now)

I hope that I have explained this in enough detail to get the understanding of what I need accross.

Thank so much for any help on this, I can show my form so far if you need to see that.
Sincerely,
letam
Sep 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: 3
here is a link to the actually form I'm trying to get to work

http://www.truthinhisword.org/test2.html

Gosh, thank you for any help!

Letam
Sep 22 '06 #2

P: 3
Sorry, I'm real new at this posting, I should have posted this before.
Any help with htis project would be great!


Expand|Select|Wrap|Line Numbers
  1. <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <title>create your own</title>
  5.  
  6. <!-- hide/show snack -->
  7. <script type="text/javascript">
  8. <!--
  9.  
  10. function changeDiv(the_div,the_change)
  11. {
  12.   var the_style = getStyleObject(the_div);
  13.   if (the_style != false)
  14.   {
  15.     the_style.display = the_change;
  16.   }
  17. }
  18.  
  19. function hideSnack()
  20. {
  21.   changeDiv("Snack","none");  
  22.  
  23.  }
  24.  
  25. function getStyleObject(objectId) {
  26.   if (document.getElementById && document.getElementById(objectId)) {
  27.     return document.getElementById(objectId).style;
  28.   } else if (document.all && document.all(objectId)) {
  29.     return document.all(objectId).style;
  30.   } else {
  31.     return false;
  32.   }
  33. }
  34. // -->
  35. </script>
  36.  
  37.  
  38. <!-- hide/show candy -->
  39.  
  40.  
  41. <script type="text/javascript">
  42. <!--
  43.  
  44. function changeDiv(the_div,the_change)
  45. {
  46.   var the_style = getStyleObject(the_div);
  47.   if (the_style != false)
  48.   {
  49.     the_style.display = the_change;
  50.   }
  51. }
  52.  
  53.  function hideCandy()
  54. {
  55.  
  56.   changeDiv("Candy","none");
  57.  
  58.  }
  59.  
  60. function getStyleObject(objectId) {
  61.   if (document.getElementById && document.getElementById(objectId)) {
  62.     return document.getElementById(objectId).style;
  63.   } else if (document.all && document.all(objectId)) {
  64.     return document.all(objectId).style;
  65.   } else {
  66.     return false;
  67.   }
  68. }
  69. // -->
  70. </script>
  71.  
  72.  
  73.  
  74.  
  75. <!-- hide/show combo -->
  76.  
  77. <script type="text/javascript">
  78. <!--
  79.  
  80. function changeDiv(the_div,the_change)
  81. {
  82.   var the_style = getStyleObject(the_div);
  83.   if (the_style != false)
  84.   {
  85.     the_style.display = the_change;
  86.   }
  87. }
  88.  
  89.  function hideCombo()
  90. {
  91.  
  92.   changeDiv("Combo","none");
  93.  
  94.  }
  95.  
  96. function getStyleObject(objectId) {
  97.   if (document.getElementById && document.getElementById(objectId)) {
  98.     return document.getElementById(objectId).style;
  99.   } else if (document.all && document.all(objectId)) {
  100.     return document.all(objectId).style;
  101.   } else {
  102.     return false;
  103.   }
  104. }
  105. // -->
  106. </script>
  107.  
  108.  
  109.  
  110.  
  111.  
  112. </head>
  113. <BODY text="#010082" vLink="#010082" aLink="#010082" link="#010082" bgColor="#ffffff" background="">
  114.  
  115. <CENTER>
  116. <BR>
  117.  
  118. <!-- start Order Form -->
  119.  
  120. <form name="myform" action="/cgi/formmail.cgi" method=post>
  121. <input type="hidden" name="recipient" value="letam@yahoo.com">
  122. <input type="hidden" name="subject" value="Order">
  123. <input type="hidden" name="redirect" value="/Successful-Order.html">
  124.  
  125.  
  126.  
  127. <TABLE bgColor="#FFFFCC" border=1 cellpadding=5>
  128. <TR>
  129.     <TD><FONT SIZE="-1" face="arial" COLOR="#2E3194">* (Require)</FONT><BR>
  130. <FONT SIZE="2" COLOR="#2E3194" face="arial">* Name: <INPUT TYPE="text" name="requiredName" SIZE="33"><BR>
  131. * Home Address: <INPUT TYPE="text" NAME="requiredAddress" SIZE="25"><BR>
  132. * City: <INPUT TYPE="text" NAME="requiredCity" SIZE="35"><br>
  133. * State: <INPUT TYPE="text" NAME="requiredState" SIZE="2">
  134. * Zip Code: <INPUT TYPE="text" NAME="requiredZip" SIZE="5"><BR>
  135. Email: <INPUT TYPE="text" name="email" SIZE="35"><BR>
  136. * Daytime Phone: <INPUT TYPE="text" NAME="requiredDaytimePhone" SIZE="25"><BR>
  137.  
  138. </TD>
  139. </TR>
  140. </TABLE>
  141. <BR><BR>
  142.  
  143. <!-- insert order form -->
  144.  
  145. <FONT face="arial" SIZE="4" COLOR="B80940"><B>Create Your Own Variety</B></FONT>
  146. <BR><BR>
  147.  
  148. <TABLE width=100%>
  149. <TR>
  150.     <TD valign="top"><!-- insert table -->
  151. <TABLE border="1" width=100%>
  152. <TR><TD bgColor="#FFFFCC"><font face="arial" size="2">Description</FONT></TD><TD bgColor="#FFFFCC"><font face="arial" size="2">Qty</FONT></TD></TR>
  153. <TR><TD colspan="2"><FONT face="arial" size="2" color="#FF0000"><B>Create Your Own Snack Variety</B></FONT></TD></TR>
  154. <TR><TD colspan="2" align=center><FONT face="arial" size="2" color="#000000">Must be a combination of items <U>NOT</U> all of one kind. </FONT></TD></TR>
  155. <TR><TD colspan=2>
  156. <TABLE width=100%>
  157. <TR><TD><input type="radio" name="SnackVarieties" onClick="alert('Must Enter Number of Cases to Process Order!'); hideSnack(); changeDiv('Snack','block');"><FONT face="arial" size=2>Select Snack Variety<BR><input type="radio" name="SnackVarieties" onClick="hideSnack();">none<div id="Snack" style="display:none;">
  158. <TABLE border=1 width=100%>
  159. <TR><TD colspan="3"><FONT SIZE="2" COLOR="">Number of Cases</FONT> * <INPUT size="2" id="1" onchange="disable(false);" name="CYO Snack Variety Cases"><BR><FONT SIZE="1-" COLOR="">&nbsp; * required to process order </FONT></TD></TR>
  160. <TR><TD colspan="3"><FONT face="arial" size=2 color="#FF0000">Select 48 count per case</FONT></TD></TR>
  161. <TR><TD><font face="arial" size="1">Grandmas Vanilla</FONT></TD><TD><INPUT size="2" name="CYO_Snack_Variety_Grandmas_Vanilla" disabled></TD></TR>
  162. <TR><TD><font face="arial" size="1">Goldfish Cheddar</FONT></TD><TD><INPUT size="2" name="CYO_Snack_Variety_Goldfish_Cheddar" disabled></TD></TR>
  163.  
  164. <TR><TD><font face="arial" size="1">Ritz Chips Sour Cream Onion</FONT></TD><TD><INPUT size="2" name="CYO_Snack_Variety_Ritz_Chips_Sour_Cream_Onion" disabled></TD></TR>
  165. <TR><TD><font face="arial" size="1">Chex Mix Traditional</FONT></TD><TD><INPUT size="2" name="CYO_Snack_Variety_Chex_Mix_Traditional" disabled></TD></TR>
  166. </table>
  167. </div> 
  168. </TD>
  169. </TR>
  170.  </table>
  171.  </TD>
  172. </TR>
  173.  </table>
  174.  
  175. <!-- end column 2 --></TD>
  176.  
  177. <TD valign="top"><!-- insert table -->
  178.  
  179. <TABLE border="1" width=100%>
  180. <TR><TD bgColor="#FFFFCC"><font face="arial" size="2">Description</FONT></TD><TD bgColor="#FFFFCC"><font face="arial" size="2">Qty</FONT></TD></TR>
  181. <TR><TD colspan="2"><FONT face="arial" size="2" color="#FF0000"><B>Create Your Own Candy Variety</B></FONT></TD></TR>
  182. <TR><TD colspan="2" align=center><FONT face="arial" size="2" color="#000000">Must be a combination of items <U>NOT</U> all of one kind.</FONT></TD></TR>
  183. <TR><TD colspan=2>
  184. <TABLE width=100%>
  185. <TR><TD><input type="radio" name="CandyVarieties" onClick="alert('Must Enter Number of Cases to Process Order!'); hideCandy(); changeDiv('Candy','block');"><FONT face="arial" size=2>Select Candy Variety<BR><input type="radio" name="CandyVarieties" onClick="hideCandy();">none<div id="Candy" style="display:none;">
  186. <TABLE border=1 width=100%>
  187. <TR><TD colspan="3"><FONT SIZE="2" COLOR="">Number of Cases</FONT> * <INPUT size="2" id="2" onchange="disable(false);" name="CYO Candy Variety Cases"><BR><FONT SIZE="1-" COLOR="">&nbsp; * required to process order </FONT></TD></TR>
  188. <TR><TD colspan="3"><FONT face="arial" size=2 color="#FF0000">Select 60 count per case</FONT></TD></TR>
  189. <TR><TD><font face="arial" size="1">Caramello</FONT></TD><TD><INPUT size="2" name="CYO_Candy_Variety_Caramello" disabled></TD></TR>
  190. <TR><TD><font face="arial" size="1">Kit Kat</FONT></TD><TD><INPUT size="2" name="CYO_Candy_Variety_Kit_Kat" disabled></TD></TR>
  191.  
  192. <TR><TD><font face="arial" size="1">Fruit Chews</FONT></TD><TD><INPUT size="2" name="CYO_Candy_Variety_Fruit_Chews" disabled></TD></TR>
  193. <TR><TD><font face="arial" size="1">Gobstoppers</FONT></TD><TD><INPUT size="2" name="CYO_Candy_Variety_Gobstoppers" disabled></TD></TR>
  194.  
  195. </TABLE></div></TD>
  196. </TR>
  197. </TABLE>
  198.  
  199. </td>
  200. </tr>
  201. </table>     
  202.  
  203.  
  204. <!-- end column 4 --></TD>
  205.  
  206.  
  207.  
  208.     <TD valign="top"><!-- insert table -->
  209.  
  210. <TABLE border="1" width=100%>
  211. <TR><TD bgColor="#FFFFCC"><font face="arial" size="2">Description</FONT></TD><TD bgColor="#FFFFCC"><font face="arial" size="2">Qty</FONT></TD></TR>
  212. <TR><TD colspan="2"><FONT face="arial" size="2" color="#FF0000"><B>Create Your Own Combo Variety</B></FONT></TD></TR>
  213. <TR><TD colspan="2" align=center><FONT face="arial" size="2" color="#000000">Must be a combination of items <U>NOT</U> all of one kind.</FONT></TD></TR>
  214. <TR><TD colspan=2>
  215. <TABLE width=100%>
  216. <TR><TD><input type="radio" name="ComboVarieties" onClick="alert('Must Enter Number of Cases to Process Order!'); hideCombo(); changeDiv('Combo','block');"><FONT face="arial" size=2>Select Combo Variety<BR><input type="radio" name="ComboVarieties" onClick="hideCombo();">none<div id="Combo" style="display:none;">
  217. <TABLE border=1 width=100%>
  218. <TR><TD colspan="3"><FONT SIZE="2" COLOR="">Number of Cases</FONT> * <INPUT size="2" id="3" onchange="disable(false);" name="CYO Combo Variety Cases"><BR><FONT SIZE="1-" COLOR="">&nbsp; * required to process order </FONT></TD></TR>
  219.  
  220. <TR><TD><font face="arial" size="1">Rice Krispies Treats</FONT></TD><TD><INPUT size="2" name="CYO_Combo_Variety_Rice_Krispie_Treats" disabled></TD></TR>
  221. <TR><TD><font face="arial" size="1">Farley's Fruit Snacks</FONT></TD><TD><INPUT size="2" name="CYO_Combo_Variety_Farleys_Fruit_Snacks" disabled></TD></TR>
  222. <TR><TD><font face="arial" size="1"> Now or Laters</FONT></TD><TD><INPUT size="2" name="CYO_Combo_Variety_Now_or_Laters" disabled></TD></TR>
  223.  
  224. <TR><TD><font face="arial" size="1">Snickers</FONT></TD><TD><INPUT size="2" name="CYO_Combo_Variety_Snickers" disabled></TD></TR>
  225.  
  226. </TABLE></div></TD>
  227. </TR>
  228. </TABLE>
  229.  
  230. </td>
  231. </tr>
  232. </table>     
  233.  
  234.  
  235. <!-- end column 4 --></TD>
  236. </TR>
  237. </TABLE>
  238.  
  239. <BR><BR>
  240.  
  241.  
  242.  
  243.  
  244.     <input type=submit value="Submit Order"> <input type=reset>
  245.         </form> 
  246.  
  247.  
  248.  
  249. </CENTER>
  250. </body>
  251. </html>
  252.  
  253.  
Sep 22 '06 #3

Post your reply

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