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

how to enable radio button in onchange of a drop down

Hello Friends....... in my project i am having a dropdown and based on the values selected from the dropdown, i have to enable 2 radio button. in the on change function of drop down i have written the code. but radio button is not getting enabled, it just blinks and get disabled. this is the code... radio button is disabled by default.[php]<select name="tak" class="style21" onChange="tlkdisp(document.form1)">function tlkdisp(Object)
{
var index=Object.tak.selectedIndex;
var value=Object.tak.options[index].value;
if(Object.tak.options[index].value >0 )
{
document.form1.radiobutton[0].disabled=false;
document.form1.radiobutton[1].disabled=false;
document.form1.radiobutton1[0].disabled=false;
document.form1.radiobutton1[1].disabled=false;
}
document.form1.action="Vr.php?tak="+value;
document.form1.submit();
return false;
}[/php]
thanks..............
Apr 16 '08 #1
11 9251
TheServant
1,168 Expert 1GB
Looks like javascript to me? And it sounds like something you would need javascript for anyway. PHP cannot do this alone, so if you don't want to use javascript you will need AJAX. A moderator should move this to the javascript forum soon.
Apr 16 '08 #2
ronverdonk
4,258 Expert 4TB
warning:

Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future.

MODERATOR
Apr 16 '08 #3
ronverdonk
4,258 Expert 4TB
What has this got to do with PHP??

I'll move this to the JavaScript forum.

moderator
Apr 16 '08 #4
acoder
16,027 Expert Mod 8TB
Hello Friends....... in my project i am having a dropdown and based on the values selected from the dropdown, i have to enable 2 radio button. in the on change function of drop down i have written the code. but radio button is not getting enabled, it just blinks and get disabled. this is the code... radio button is disabled by default.
Show the HTML code. Do you get any errors?
Apr 17 '08 #5
Hello friends..... is it possible to enable radio button in the "onchange" function of an dropdown list using java script in php.

function tlkdisp(Object)
{
var index=Object.tak.selectedIndex;
var value=Object.tak.options[index].value;
document.form1.radiobutton[0].disabled=false;
document.form1.radiobutton[1].disabled=false;
document.form1.action="Vresurvey.php?tak="+value;
document.form1.submit();

return false;
}

<select name="tak" class="style21" style="font-family:MLB-TTRevathi" onChange="tlkdisp(document.form1)"

this is my code... but i am not able to enable the radio button, it just blinks when i select the dropdownlist..

thanks.
Apr 21 '08 #6
Markus
6,050 Expert 4TB
Hello friends..... is it possible to enable radio button in the "onchange" function of an dropdown list using java script in php.

function tlkdisp(Object)
{
var index=Object.tak.selectedIndex;
var value=Object.tak.options[index].value;
document.form1.radiobutton[0].disabled=false;
document.form1.radiobutton[1].disabled=false;
document.form1.action="Vresurvey.php?tak="+value;
document.form1.submit();

return false;
}

<select name="tak" class="style21" style="font-family:MLB-TTRevathi" onChange="tlkdisp(document.form1)"

this is my code... but i am not able to enable the radio button, it just blinks when i select the dropdownlist..

thanks.
This has nothing to do with php.

Regards
Apr 21 '08 #7
gearoid
21
Hello friends..... is it possible to enable radio button in the "onchange" function of an dropdown list using java script in php.

function tlkdisp(Object)
{
var index=Object.tak.selectedIndex;
var value=Object.tak.options[index].value;
document.form1.radiobutton[0].disabled=false;
document.form1.radiobutton[1].disabled=false;
document.form1.action="Vresurvey.php?tak="+value;
document.form1.submit();

return false;
}

<select name="tak" class="style21" style="font-family:MLB-TTRevathi" onChange="tlkdisp(document.form1)"

this is my code... but i am not able to enable the radio button, it just blinks when i select the dropdownlist..

thanks.
I'd recommend looking for an AJAX solution to this - shouldn't be terribly difficult!
Apr 21 '08 #8
Markus
6,050 Expert 4TB
I'd recommend looking for an AJAX solution to this - shouldn't be terribly difficult!
Pointless using ajax when there's a pure (and incredibly basic) javascript solution. Using ajax would take up unecessary server resources.

Ask in the JS forum
Apr 21 '08 #9
Hello friends..... is it possible to enable radio button in the "onchange" function of an dropdown list using java script in php.

Expand|Select|Wrap|Line Numbers
  1. function tlkdisp(Object)
  2. {
  3. var index=Object.tak.selectedIndex;
  4. var value=Object.tak.options[index].value;
  5. document.form1.radiobutton[0].disabled=false;
  6. document.form1.radiobutton[1].disabled=false;
  7. document.form1.action="Vresurvey.php?tak="+value;
  8. document.form1.submit();
  9.  
  10. return false;
  11. }
<select name="tak" class="style21" style="font-family:MLB-TTRevathi" onChange="tlkdisp(document.form1)"

this is my code... but i am not able to enable the radio button, it just blinks when i select the dropdownlist..

thanks.
Apr 22 '08 #10
acoder
16,027 Expert Mod 8TB
Merged multiple threads. Do not double/triple post.

Please enclose your posted code in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use [code] tags in future.

Moderator.
Apr 22 '08 #11
acoder
16,027 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. function tlkdisp(Object)
  2. {
  3. var index=Object.tak.selectedIndex;
  4. var value=Object.tak.options[index].value;
  5. document.form1.radiobutton[0].disabled=false;
  6. document.form1.radiobutton[1].disabled=false;
  7. document.form1.action="Vresurvey.php?tak="+value;
  8. document.form1.submit();
  9.  
  10. return false;
  11. }
Replace lines 5-6 with:
Expand|Select|Wrap|Line Numbers
  1. var radios = document.form1.radiobutton;
  2. for (i = 0; i < radios.length; i++) {
  3.   radios[i].disabled=false;
  4. }
Don't use Object as an argument name- it has special meaning in JavaScript, use something like obj instead.
Apr 22 '08 #12

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

Similar topics

5
by: EviL KerneL | last post by:
Hi - I am trying to figure out a way to enforce the validation included for this form based on whether the user chooses "email" or "phone" as the contact choice. Right now it is set to enforce...
5
by: Mike Griffin | last post by:
I would like to have a drop down box where when the user selects one of the choices, it automatically loads another page. I want this to be a one stop select and go. No submit or OK button. Just...
2
by: tpaulson | last post by:
I have a couple of DIV's that I hide/display based on radio buttons. On the DIV's, I have multiple drop down boxes. The source shows that they are populated, but I can't make them drop down. Only...
1
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...
1
by: Sujoan | last post by:
Hi, I would like to add a button with drop down menu to standard toolbar in internet explorer(like the mail button). Is it possible to do that using C#? Please somebody give some information on...
3
by: donald | last post by:
Hi there, Is there a button which i can use of a form which has a button and a arrow next to it with a list of other buttons. Like New in Outlook or Undo in Word? Is there on in the .NET...
1
by: s.chelliah | last post by:
Hi, I am trying to use javascript, div tag and radio button to disable/enable a text box. It works fine in netscape and firefox, but in IE, the text box is not disabled when the user checks the...
11
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...
1
by: daydreaming | last post by:
Hi All, I would like to know is there any way to set the color of the button in drop-down menu. Below is the sample HTML object (select) that I would like to set its button color. <html>...
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:
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
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...
0
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...
0
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...
0
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,...

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.