473,626 Members | 3,316 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

List box selection should decide the text boxes display

subashini Thiyagarajan
218 New Member
Hi,
I am inserting a record in Access table using ASP,it is working fine.i have so many text boxes,list boxes to get the input fields.


Actually for all the insert cases i don't require all the fields to be filled.
i need to restrict the user input depend on the first list box seletion.


i have populated the list box items,as soon as user wants to insert a record first ,user should select a list box item,as soon as an item selected required text box should remain exist in the form other unwanted text boxes either disappear or blocked agaist entry or any marks to be put optional.



Any one can help me.this is going to play a vital role overall.please
Dec 28 '06 #1
13 3381
karthi84
271 Contributor
hi,
this can be solved with a switch case statement. based on the value of the first list box hide the input fields which you dont require.

i have not tried it but this idea can be useful to u.
Dec 29 '06 #2
subashini Thiyagarajan
218 New Member
i ll make a attempt with your suggestion.
Jan 2 '07 #3
karthi84
271 Contributor
u can also use the if condition to check the list box and decide the required textboxes based on the selection.
Jan 2 '07 #4
subashini Thiyagarajan
218 New Member
How to do i am not getting? Forget about background process of taking it to table.that i ll take care.

i want to deactivate fields in real time.as a intelligent s/w.my aim is, we should not allow the user to fill the unwanted text boxes at all.
Jan 3 '07 #5
karthi84
271 Contributor
do u want to hide the textbox completely or make it disabled on the listbox selection.
Jan 4 '07 #6
subashini Thiyagarajan
218 New Member
Make It Disabled On List Box Selection
Jan 4 '07 #7
karthi84
271 Contributor
here r the coding to solve ur problem
Expand|Select|Wrap|Line Numbers
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
  2. <script>
  3.      function changeColor(value) {
  4.      var valu = document.form.opt.options.selectedIndex;
  5.      if (valu==1)
  6.      {
  7.      document.form.txtBx1.disabled = true;
  8.      document.form.txtBx2.disabled = false;
  9.      }
  10.      else if (valu==2)
  11.      {
  12.      document.form.txtBx1.disabled = false;
  13.      document.form.txtBx2.disabled = true;
  14.      }
  15.      }
  16.      function sbmt(form)
  17. {
  18.        document.form.page.value=1;
  19.        document.form.submit();
  20.    }
  21.  
  22.  
  23.  </script>
  24. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  25. <% if( Request.Form("page")="" )then %>
  26. <html>
  27. <head>
  28. <title>Change background color from a drop-down list</title> 
  29. </head>
  30. <body>
  31. <form name="form" action="testoption.asp" method="post"> 
  32.  <select id="colorPicker"  name="opt" onChange="changeColor(this.options[this.selectedIndex].value)">
  33.   <option>Background Color
  34.   <option value="0000FF">Blue
  35.   <option value="FF0000">Red
  36.  </select>
  37.  <input name="txtBx1" type="text" id="txtBx1" value="">
  38.  <input name="txtBx2" type="text" id="txtBx2" value="">
  39.  <input type="hidden" name="page" value="1">
  40.  <input type="button" name="Submit" value="Submit" onClick=sbmt(this.form)> 
  41. </form>
  42. <%else
  43. response.Write("here goes ur submit part")
  44. end if%>
  45. </body>
  46. </html>
  47.  
after the else comes the codes for the other buttons in ur page
Jan 4 '07 #8
subashini Thiyagarajan
218 New Member
My Hearty thanks to you.i am modifying according to my requirement.
Jan 4 '07 #9
karthi84
271 Contributor
thats all right. have u got what u required from that.
Jan 4 '07 #10

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

Similar topics

2
2275
by: Jeff | last post by:
Hello All: What I am trying to do is bind a textbox (really several text boxes) based on a list box selection. Basically what I'm dealing with are two tables with a 1 to 1 relationship. I have created the dataset and defined the relationship between the two tables in the schema. I add a list box to a form and set it's datasource to the parent table and its
4
20993
by: JohnSouth104 | last post by:
Hi I want to warn the user that changing the selected item in a pull-down will clear some data he has already entered in a file download box. I've tried using confirm() to return true or false with a line such as: onchange="return(confirm('proceed Yes or No')))" but it always stops the change.
8
2563
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and courses are populated. When course is selected, lists of occurrences, groups and
5
11444
by: Kay | last post by:
Hello, I have two list boxes on my form, one initially displays with items and the other displays blank, by clicking a button, it is possible to move items from one box to another and vice a versa, this works fine. I also have a dropdown list on the page with autopost back = true, my problem is as follows: when the user selects an option in the dropdown list the form is posted back to the server and certain other processing happens, then...
0
1133
by: thusnani | last post by:
Hopefully someone can help me out with this situation. Im working with a form that inputs the hours an employee works on certain projects and general admin categories per week. Right now i have two list boxes that display the projects and general admin categories, each of which have an extended multi select. I want to make some sort of button which generates just a list of
4
64582
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one determines the available options in the other. TERMINOLOGY Row Source: The table/query from which the Combo Box or List Box gets its values. Note: There are other types of row sources that can be used but for simplicity we will stick with Tables...
5
6731
by: Andrew Meador | last post by:
I have a form (Change Card List by Status) with a check box (cboNOT) and a list box (lstStatus). There is an Open Report button that opens a report (Report - Change Card List) which uses a query (SQL -Change Card List). What I want to do is have the form open the report where a filter is set to use the values from the check box AND the value selected from the list box to generate the report. What I can't figure out is how to use the...
1
4157
by: freetime | last post by:
Greetings, This is my first post so I will try to be brief and accurate. I have a report that uses 9 user selectable filters (Dates, Y/N's as Combo Boxes and 4 Multi-Select List Boxes. 2 of the Multi-Select Boxes acquire their data from other tables as Lookup's. All functions for the filters operate properly pulling the data needed. One of my options with the data is to send it to a Report that can be printed. The request...
0
8272
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...
0
8205
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8713
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8644
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8514
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5579
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();...
1
2632
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
1
1817
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1516
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.