473,657 Members | 2,407 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with disable/enable script for multible text fields

3 New Member
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 3762
letam
3 New Member
here is a link to the actually form I'm trying to get to work

http://www.truthinhisw ord.org/test2.html

Gosh, thank you for any help!

Letam
Sep 22 '06 #2
letam
3 New Member
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
9732
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 in my asp form i use a checkbox and fot he other field i use a normal text box. if the yes/no field is checked then the other field is enabled otherwise it has to be disabled.Here's what i've done so far: Do While Not ObjRS.EOF <td><input...
7
8690
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, somehow I always end up with error messages and functions not working right. Can someone please help me? I have a form, inside is 1 Text Field and 2 Password Fields. What I'm looking to do is: - Make sure password fields are equal - Set...
12
8869
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
4243
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 is selected - enable a field to use the M$ Datepicker. Using the code below works for most of our fields, however the problem is that when the field is re-enabled - it remembers the original date or data prior to it being disabled - despite the...
8
5463
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 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
13
3699
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 http://www.opennetcf.org/forums/post.asp?method=ReplyQuote&REPLY_ID=3922&TOPIC_ID=2224&FORUM_ID=35
6
1904
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 allow the user to type in a value. Also, I would like the 2nd option only editable if the button for that option is selected. All I can seem to find is basic examples of forms, and none of which have this feature. The form would look something...
0
5558
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 ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
6
2187
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 back to server. Is this a bug? Thanks,
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7351
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2740
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.