473,769 Members | 5,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

enable/disable radio buttons

pradeepjain
563 Contributor
Expand|Select|Wrap|Line Numbers
  1. for($i = 1; $i <= 15 ; $i++){
  2. for($k = 1; $k <= 10 ; $k++){
  3. $myresult .= "<input class='star' type='radio' name='rating".$i."' id='rating".$i."' value='". $k ."' disabled='true'  $chk  title='". $k." out of 10 ' />";
  4. }
  5. }
  6. $myresult .= "<a href='#' id=\"rate-it\" onclick=\"test('rating".$i."');\">Rate It</a>";
  7. <script type='text/javascript'>
  8. function test(name){
  9.         document.ratings.rating1.disabled = false;
  10.         document.ratings.rating2.disabled = false;
  11.         document.ratings.rating3.disabled = false;
  12. alert('hai');
  13. }
hi i am working on a product site where in i display 10 radio button for 15 features of a product for user to rate . and each check box is disabled by default and i add a rate it button "rate-it" which on click should enable 1 row of checkboxes . i tried to write code for tht . its print the alert msg and all. but enabling the checkboxes is not working any help on it!?
Dec 14 '09
19 6594
pradeepjain
563 Contributor
you mean to say each radio button should have a diff id like rating11,rating 12 for 1st row and rating21,rating 22 for second row!!
Dec 15 '09 #11
Dormilich
8,658 Recognized Expert Moderator Expert
jepp, as demanded by the DTD.
Dec 15 '09 #12
pradeepjain
563 Contributor
okie i did that and it worked ,, i tried to apply some jquery to it .. when its applied it stops working . but without the jquery it works f9!

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 src="jquery.js" type="text/javascript" language="javascript"></script>
  10. <script src="jquery.rating.js" type="text/javascript" language="javascript"></script>
  11.         <link href="jquery.rating.css" type="text/css" rel="stylesheet"/>
  12.  
  13. <script type="text/javascript">
  14. function test(name)
  15. {
  16.     alert(name);
  17.    for (k=1; k<=10; k++){
  18.     document.getElementById(name+k).disabled=false;
  19. }
  20. }
  21. </script>
  22. </HEAD>
  23.  
  24. <BODY>
  25. <?php
  26. for($i = 1; $i <= 15 ; $i++){
  27.  for($k = 1; $k <= 10 ; $k++){
  28.  $myresult .= "<input class='star' type='radio' name='rating".$i."' id='rating".$i."".$k."' value='". $k ."' disabled='true'  $chk  title='". $k." out of 10 ' />";
  29.  }
  30. $myresult .= "<a href='#' id=\"rate-it\" onclick=\"test('rating".$i."');\">Rate It</a><br/>";
  31.  }
  32. echo $myresult;
  33.  ?>
  34. </BODY>
  35. </HTML>
and the jquery.rating.j s, jquery.rating.c ss are taken form the below site .

http://www.fyneworks.com/jquery/star.../#tab-Overview
Dec 15 '09 #13
pradeepjain
563 Contributor
is there no solution for this or has no1 looked at this problem?
Dec 21 '09 #14
Dormilich
8,658 Recognized Expert Moderator Expert
my problem is, that I don’t know jQuery.
Dec 21 '09 #15
pradeepjain
563 Contributor
some suggestions for what might be causing problems here.. bcos with out jquery everything works very well. but as soon as jquery is applied and radio buttons are replaced with stars it stops working :I(
Dec 21 '09 #16
Dormilich
8,658 Recognized Expert Moderator Expert
I think your code works as intended…

… only that your stars are no radio buttons.

PS. check out the demo page with FireBug, you will see, that all radio buttons are hidden and instead some divs are visible. thus your radio buttons are disabled, but it doesn’t matter.

PPS. what an ‘obvious’ error, *sigh*
Dec 21 '09 #17
drhowarddrfine
7,435 Recognized Expert Expert
all tag names upper case and all attribute names lowercase.
Actually, tag and attribute names are case insensitive in HTML and, nowadays, lowercase is most used.
Dec 21 '09 #18
pradeepjain
563 Contributor
@Dormilich
you mean to say that the button thing will not work ! no other work around for this?
Dec 30 '09 #19
Dormilich
8,658 Recognized Expert Moderator Expert
the button thing will work, only it doesn’t matter, because the buttons are invisible. to do anything on the stars, you have to meddle with the plugin.
Dec 30 '09 #20

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

Similar topics

1
2471
by: Manatee | last post by:
Hi group. I have exactly one external, alternate stylesheet that I want to enable or disable by form controls, on one page only (not saved across pages). I used: <link rel="alternate stylesheet" id="style-compact" etc...> <input name="view" type="radio" onclick="document.getElementById('style-compact').disabled=false">
1
4254
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 is selected - enable a field to use the M$ Datepicker. Using the code below works for most of our fields, however the problem is that when the field is re-enabled - it remembers the original date or data prior to it being disabled - despite the...
2
33851
by: teddy.am | last post by:
Guys, I have a set of 6 radio buttons, infront of each one there's a textbox .... i need all textboxes disabled .... once one of the radio buttons is selected, the texbox infront of it will be anabled to type in ... any fast solution?
2
26371
by: Kevin | last post by:
I've been looking all over and I can't seem to find what ought to be simple. I need to disable a drop down when a checkbox is checked, and enable it when same checkbox is unchecked. I've found any number of scripts to disable / enable a drop down but they are all made to work with 2 different buttons, radio group selections, etc. I can't seem to come up with one that can toggle off a single checkbox.
1
1928
by: scanreg | last post by:
My form needs to (1) direct to specified URLs based on a combination of form selections and (2) enable/disable form features based on selections within the form FORM Radio 1 - A - B - C Select Box 1
6
5553
by: Brandon McCombs | last post by:
Hello, I have a form that contains a listview on the left side and a column of buttons on the right side. Only some of the buttons do I want enabled all the time. The other buttons should be enabled only if something is selected in the listview. That part specifically works but not very well. It seems that I can only get the buttons to disable if I click off the text of the items in the listview but still within about 10-20 pixels of...
3
11661
by: Pietro | last post by:
Hi all, First of all I'd like to thank you very very much ,as finally after many years of searching,I could find a code to disable/enable the shift key,but actually i cannot use the code as I'm very new to VBA,i tried to follow the instructions reported in the code,but i got no result,i still can use the shift key,can you explain in details how to use it correctly to enable/disable users from pressing shift key to view database windw?,the...
3
2442
by: sumanbangladesh | last post by:
Hi I have a page with 3 radio butons. If I select a specific one,then I like to view some other radio buttons otherwise the other radio buttons will be remain disabled or invisible. I am very new in Javascript and waiting for your kind response Thanks in advance
0
9587
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
9423
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
10211
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
10045
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
9993
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,...
0
9863
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
8870
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3958
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

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.