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

enable a few text box by clicking a radio button

2
Hello all,

I need heeeeeeeeeeeeeeeelp...

how can I enable/disable a few text box after clicking a radio button?

I found this code in this site but it's only refer to one text feild and I need to activate 5 text field... (any changes that I try to insert to the code , didn't help at all, they only made it worse)

here is the code:

<body>
<script type="text/javascript">
var currentEnabled = null;
function enableElement(elem) {
if (currentEnabled) {
currentEnabled.disabled = true;
}
elem.disabled = false;
currentEnabled = elem;
}
</script>

<form action="">
<input type="text" name="inp1" disabled="disabled">
<input type="radio" name="sel" value="1"
onclick="enableElement(this.form.elements['inp1','inp2']);">

<br>
<input type="text" name="inp2" disabled="disabled">
<input type="radio" name="sel" value="2"

<br>
<input type="text" name="inp3" disabled="disabled">
<input type="radio" name="sel" value="3"

</form>

</body>

I woulappriciate any help

thank you

orit
May 23 '07 #1
3 4331
pbmods
5,821 Expert 4TB
Heya, orita. Welcome to TSDN!

Try this;

Expand|Select|Wrap|Line Numbers
  1. <input type="radio" name="sel" value="1"
  2. onclick="function() {
  3. enableElement(this.form.elements['inp1','inp2']);
  4. etc.
  5. }">
May 24 '07 #2
orita
2
Heya, orita. Welcome to TSDN!


Try this;
hello pbmods,

first - thanks for the fast answer,

but - it didn't solved the problem.....

I think that I need to change the function in some way, so it would take care
for all the relevent text field....

anymore idea????

orit
May 24 '07 #3
dmjpro
2,476 2GB
this elements['inp1','inp2'] means that elements['inp2'] not the array containing two input fields.

so build the array before call the function or build the array inside the function.
which one u prefer.

best of luck.

kind regards.
dmjpro.
May 24 '07 #4

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

Similar topics

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...
9
by: Marc | last post by:
Okay, here's the problem - I have 3 radio buttons, and 11 check boxes (which are disabled by default). I have the javascript below which when the last radio button is clicked, enables the...
2
by: xazos79 | last post by:
Hi All, I've come across the problem of not being able to re-enable a radio button with javascript if its initial state has been disabled in the Page_Load() method of the code behind. Might i...
6
by: Ian Davies | last post by:
Hi me again, sorry to be a pain. Ive been struggling with this one all day. Hope you can understand whats happening. First my script is below. Have a look and I'll explain at the bottom what it...
2
by: rn5a | last post by:
In a shopping cart app, assume that a user has placed 4 orders (each order has a corresponding OrderID which will be unique). When he comes to MyCart.aspx, by default, the details of his last order...
10
by: apparker | last post by:
I'm creating a new GUI for a program and it is for a medical exam. There are so many different things to ask someone during a history it wastes too much space to make checkboxes for everything so I...
1
by: truptidalia | last post by:
Hello, I am trying to add 2 RadioButtons in a form in js dynamically. I can see 2 radiobutttons, but no text. On clicking them, their is no selection. One of them is selected. I need to...
11
by: JWest46088 | last post by:
I'm having difficulty trying to figure out how to print a text file from a hash table one line at a time. I have the text file read into the hash table and can print the text file all at once, but I...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...

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.