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

Home Posts Topics Members FAQ

auto select radio button

7 New Member
how do we auto selected a radio button when the user enters a numeric value in a textbox?

my code for radio button and text box are as follows:
Expand|Select|Wrap|Line Numbers
  1. <li>Do you like your membership priviledge?
  2.            <br />
  3.            <input type="radio" name="think" id="yes" value="yes">
  4.            <label for="yes">Yes</label>
  5.            <br />
  6.            <input type="radio" name="think" id="no" value="no">
  7.            <label for="no">No</label>
  8.        </li>
  9.        <li>If you answered Yes to the above, how much more would you be willing to pay?
  10.            $<input class="blue" type="text" name="money" />
  11.        </li>
  12.  
can anyone pls help cause I'm really stuck here. Thanks.
Apr 15 '10 #1
1 3392
RamananKalirajan
608 Contributor
Hi Izzy,
I have give a sample code which will check the radio obj when the user enters a number in input text.


Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE> New Document </TITLE>
  5. <META NAME="Generator" CONTENT="EditPlus">
  6. <META NAME="Author" CONTENT="">
  7. <META NAME="Keywords" CONTENT="">
  8. <META NAME="Description" CONTENT="">
  9. <script type="text/javascript">
  10. function isNumberKey(evt)
  11. {
  12.      var charCode = (evt.which) ? evt.which : event.keyCode
  13.      if (charCode > 31 && (charCode < 48 || charCode > 57))
  14.         return false;
  15.      return true;
  16. }
  17.  
  18. function enableRadio(evt)
  19. {
  20.    var obj = isNumberKey(evt);
  21.    if(obj==true)
  22.    {
  23.         document.getElementById('yes').checked=true;
  24.         return true;
  25.    }
  26.    else
  27.         return false;
  28. }
  29. </script>
  30. </HEAD>
  31.  
  32. <BODY>
  33. <input type="text" onkeypress="return enableRadio(event)" name="txtChar" />
  34. <input type="radio" name="think" id="yes" value="yes">
  35. </BODY>
  36. </HTML>
Thanks and Regards
Ramanan Kalirajan
Apr 15 '10 #2

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

Similar topics

1
5242
by: JT | last post by:
I have an input form for which I've created a "matrix" for user input. Basically, the user chooses a radio button and then through javascript, a select box is displayed to define a value for that radio option, like so: Choice: (Radio1) type: (select box1) Choice: (Radio1) type: (select box2) Choice: (Radio1) type: (select box3) Choice: (Radio1) type: (select box4) Choice: (Radio1) type: (select box5)
12
6533
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the courses to pass the correct option value and then be displayed at the following URL: http://www.dslextreme.com/users/kevinlyons/selectResults.html I am passing countries, products, and courses. The first two display
4
7391
by: bobsawyer | last post by:
I've been building a series of SELECT lists that are populated dynamically using HTTPRequest. Things are going pretty well, and I've got the whole thing working flawlessly in Mozilla/Firebird. Unfortunately, Internet Explorer doesn't quite work as expected -- it gives me an "invalid argument" error that I don't know how to fix. Here's the entire script, with form, annotated to explain what I'm doing and where the problem is occurring. I...
1
2972
by: Joe Attardi | last post by:
Hi all, On a form on one of my pages I have two <select> elements, and each one is paired up with a radio button. The idea is to choose an item from one list or the other and select the radio button of the list you want to use. I'm using JavaScript to automatically select the radio button corresponding to a list when you click on the list (using the onclick event handler). Is that the best event to change on, or should this
2
12425
by: Eric Layman | last post by:
Hi, I have a radio button and a combo box. Upon changing a value for radio button, the combo box values will be dynamically updated. I have an idea on how to go abt doing it but Im stuck into converting into code.
2
1707
by: des-sd | last post by:
Access Experts, Please help! I have looked through ref. manuals, Google Groups on "Auto Populate", and I am still lost. Problem #1 My DB is 2 relational tables of (1) sales transactions of, (2) radio stations. A transacation may/may not contain multiple radio stations. Each radio station is in a radio market (eg. Los Angeles or Miami). Each radio market has a ranking. A 3rd table contains all markets and their rankings in...
11
2636
by: vinceboy | last post by:
Hi..guys!I have a drop down menu with javascript null validation.However,instead of clicking submit button,it will immediately auto redirect after option was selected.Is it possible to prevent this kind of fast respond? <select name="rNumber" title="number of ticket" onChange="GoToNextPage(this.value)"> <option selected>Select</option> <option>01</option> ...
1
2816
by: runway27 | last post by:
hi i have registration form where user selects from a drop down to select their area code apart from filling other details in the form. in the next page which is a confirmation page i would like to display the select option that a user choose in the first page i am able to display this using a textfield however i would like to display using the select drop down. following is the code for both select and radio button that i have used. 1....
1
5159
by: pravinnweb | last post by:
can anyone tell me how to set auto height to outer div that is in green box id "gray-background" it should increase relatively to inner div "smbox" here is the css and html code it should work in FF, IE6 and IE7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <TITLE> Employee Listing </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords"...
10
3403
by: mukeshrasm | last post by:
Hi I have a html in which there is two selection box and two radio button. Radio buttion is of array type. What I want if user will click the radio button then only he/she be able to make selection from select list. Initially I tried to disble the selection control. And when user will click the radio then only it was enabled. but I faced problem that value is not passed to the next form of the select list. so I enable the select list now...
0
8829
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
8734
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...
1
8508
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,...
1
6172
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5633
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
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2733
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
1962
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1627
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.