473,402 Members | 2,061 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,402 software developers and data experts.

Help with disable/enable script for multible text fields

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
2 3744
letam
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
letam
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

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

Similar topics

2
by: HolaGoogle | last post by:
Hi all, Can you please tell me what's wrong with my code??? i do have this database in wich i have to field.One is a "yes/no" field and another one is "number" field. To display the yes/no field...
7
by: Mike | last post by:
I've been trying for the past week to put a simple code together. I have done a LOT of searching, found scripts showing the functions I would like to use, however when I mix them it all goes wrong,...
12
by: Forti2ude | last post by:
Hello, I have a simple form... <form> <select name="foo" multiple> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> </select>
1
by: hortoristic | last post by:
We are using JavaScript to Enable/Disable certain fields on web pages based on business rules. A simple example is if when using an option type tag, and the two options are Yes and No. If YES...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
13
by: Chua Wen Ching | last post by:
Hi there, I saw this article here in vb.net. http://www.error-bank.com/microsoft.public.dotnet.languages.vb.1/148992_Thread.aspx and ...
6
by: drec | last post by:
I am just learning Javascript and I would like to create a basic form that gives me two options. This will be using either checkbox or radio input type, however I would like the second option to...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
6
by: =?Utf-8?B?Unlhbg==?= | last post by:
Hi, I found out that Text property is perserved, but disable/enable status is not preserved, especially I change this setting of a server side text box with client side javascipt and then post...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.