473,385 Members | 1,753 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,385 software developers and data experts.

Disabling an input when certain criteria are met.

hello friends,
i m working in php .i wsnt to know about feild validations .As i want to select data from combobox .according to that selected data feilds is to be editable Say for example :
In combobox three values r to be filled .
first name.
last name
age
Now if we select first name then age & lastname feild should be disable.
only firstname feild should be enable.
similarly for two feilds.
As we enter the value in respective feilds and search it it shows the complete data.respect to that feilds where we enter the data.
As i m new fo php please tell me how i validatde the feilds.
thanks
punit
Jul 24 '07 #1
2 1286
pbmods
5,821 Expert 4TB
Heya, Punit.

I'm going to go ahead and move this thread to the JavaScript forum, where one of our resident Experts will be more likely to be able to help you out.
Jul 24 '07 #2
epots9
1,351 Expert 1GB
hello friends,
i m working in php .i wsnt to know about feild validations .As i want to select data from combobox .according to that selected data feilds is to be editable Say for example :
In combobox three values r to be filled .
first name.
last name
age
Now if we select first name then age & lastname feild should be disable.
only firstname feild should be enable.
similarly for two feilds.
As we enter the value in respective feilds and search it it shows the complete data.respect to that feilds where we enter the data.
As i m new fo php please tell me how i validatde the feilds.
thanks
punit
well u can do it in php, but a better way would be to use javascript.

to the drop down list add the attribute 'onchange', like this:
[html]
<select id="list" onchange="myFunction(this.selectedIndex);">
<!--options-->
</select>
[/html]

in the javascript it would be

Expand|Select|Wrap|Line Numbers
  1. function myFunction(ddl)
  2. {
  3. //first option in drop down list "firstname"
  4. if(ddl == 0)
  5. {
  6. //enable
  7. //disable lastname, age
  8. }
  9. //lastname
  10. else if(ddl == 1)
  11. {
  12. //enable lastname
  13. //diable firstname, age
  14. }
  15. //nothing else, so its "age"
  16. else
  17. {
  18. //enable age
  19. //disable firstname, lastname
  20. }
  21. }
  22.  
try that out

good luck
Jul 24 '07 #3

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

Similar topics

2
by: PerryC | last post by:
Is there a way to set a certain format under the Query Criteria for input? i.e.: As user type 200000000, 200-00-0000 is displayed in the query input box. However, 20000000 is the actual value...
1
by: Steve | last post by:
I am using Access 2000 and I have a DB that is currently running four different queries from some Forms and subforms. These queries each have a date field that are seperate from each other that are...
1
by: Evelyne | last post by:
I create CheckBoxes on the fly. I want to disable the CheckBoxes when they reflect Status, so the operator does not try to input anything. However, the text/label of the CheckBox gets grayed out...
4
by: louise raisbeck | last post by:
Hi there, I have put some web controls, textboxes and drop down lists, in a Panel, so that under a certain condition i can disable all fields for input. I read in Help that disabling a Panel...
3
by: UJ | last post by:
I am going to write a class that will inherit from SqlCommand and I want to disable certain routines in the SqlCommand and add a couple of new routines. How would I go about doing that? I...
1
by: kebabkongen | last post by:
Hi, I'm working on a JavaScript that is enabling / disabling a select element according to whether a checkbox is selected or not. This works fine in Firefox, but in Internet Explorer (v 6.0.2900)...
7
by: PRESENT321 | last post by:
I have a form that appears several times on a page, and would rather not assign IDs. Is there a way to have my validation function focus() a text input without IDs? www.osbornewood.com Search...
11
by: shankwheat | last post by:
I have a function which passes text from txtdebt to debtsbox which works fine. However, I want to add code which examines the value of debtsbox and if any of the values the user entered contain the...
3
by: PowerLifter1450 | last post by:
Hi all, I have a form that shows student information (primary key = student ID). I have buttons on this form to bring up other forms that can be used to register student for certain events. The...
3
by: Jim Armstrong | last post by:
Hello all - This is driving me crazy. I have a table called tblClients - very simple, has the following fields: taxID (PK) ClientName SalesName The main form of my application allows a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
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...

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.