473,753 Members | 6,232 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Radio Button onClick Javascript should call only once

gskoli
23 New Member
Dear all,
Let me tell you the scenario , i have called javascript function on radio button selection , Ex.
Suppose There are 3 Radio Button .
Let us consider i have clicked on one radio button then
javascript is called on that and
it get 'checked' But again if if i clicked on that radio ,
Then again it will call the javascript .
So i dont want to let it happen , If radio button value got changed then only javascript should call

Please help.
Sep 1 '10 #1
7 3828
JKing
1,206 Recognized Expert Top Contributor
Try using the onchange event instead of the onclick event.
Sep 1 '10 #2
gskoli
23 New Member
Well i dint got expected result let me give you some snippet of the code.

Expand|Select|Wrap|Line Numbers
  1.  
  2. <input type='radio' name='productradio' id='proname' value='prod_name' onClick='document.frm.submit();' />Product Name&nbsp;&nbsp; 
  3. <input type='radio' name='productradio' id='procode' value='prod_code' onClick='document.frm.submit();' />Product Code&nbsp;&nbsp; 
  4. <input type='radio' name='productradio' id='cat_name' value='cat_name' onClick='document.frm.submit();' />Category Name&nbsp;&nbsp; 
  5. <input type='radio' name='productradio' id='cat_code' value='cat_code' onClick='document.frm.submit();' />Category Code
  6.  
Now if i have selected Category Name and again i am selecting that
then form should not submit .
Sep 3 '10 #3
JKing
1,206 Recognized Expert Top Contributor
Did you try using the onchange event as I suggested?

Expand|Select|Wrap|Line Numbers
  1. <input type='radio' name='productradio' id='proname' value='prod_name' onChange='document.frm.submit();' />Product Name&nbsp;&nbsp; 
  2. <input type='radio' name='productradio' id='procode' value='prod_code' onChange='document.frm.submit();' />Product Code&nbsp;&nbsp; 
  3. <input type='radio' name='productradio' id='cat_name' value='cat_name' onChange='document.frm.submit();' />Category Name&nbsp;&nbsp; 
  4. <input type='radio' name='productradio' id='cat_code' value='cat_code' onChange='document.frm.submit();' />Category Code
  5.  
Sep 3 '10 #4
gskoli
23 New Member
Yes , but dint get result...
Sep 3 '10 #5
JKing
1,206 Recognized Expert Top Contributor
Are you using any serverside code?

After you submit the form it clears the controls. You would need to save the state of the controls for this to work properly.
Sep 3 '10 #6
gskoli
23 New Member
Ya i am using perl , I have solved that problem , But Is there will be pure javascript solution to that . I have saved its status in hidden variable and used that.
Thanks
Sep 4 '10 #7
kovik
1,044 Recognized Expert Top Contributor
You seem confused.

You want a pure JavaScript solution, yet you also want to submit your form. The only way to submit a form without leaving a page is through AJAX, but I have a feeling that this isn't what you are trying to do either.


Describe exactly what you are trying to do instead of just telling us that "it didn't work."
Sep 4 '10 #8

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

Similar topics

3
2832
by: lee | last post by:
Hello I need some javascript code I've written to handle 2 values from an HTML form. I've been successful using the "label" attribute (I've simplied the example below): <input type="radio" name="group1" value="3" label="Cheese" checked>Cheese<br>
1
2418
by: Marcelo Oliveto | last post by:
Hi .... I have a radiobutton list and a label in a webform. <asp:radiobuttonlist id="one" runat="server" CssClass="text" AutoPostBack="False" RepeatDirection="Horizontal"> <asp:ListItem Value="one">one</asp:ListItem> <asp:ListItem Value="two">two</asp:ListItem> <asp:ListItem Value="three">three</asp:ListItem> <asp:ListItem Value="four">four</asp:ListItem>
2
3493
by: NishSF | last post by:
Would anyone have any suggestions/javascript code so that if one clicks the Radio Button "Yes" below he has the option of selecting any of the six CheckBox below. If the user clicks on Radio Button "No", he should not have the option of clicking on any of the six checkboxes. See Code attached. Thank you so much in advance for your help as I can't get to make this combo work. <p>Did you have any problems finding any of the information...
2
2316
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 add that it behaves fine in Firefox, but IE is unable to re-enable the radio button. IE is fine if the radio button starts in an enabled state.
9
2253
by: IchBin | last post by:
I can not see what the problem is with this script. I am just trying to set a radio button by calling setCheckedValue('abbr_letter', 'V'). Sorry I am new to javascript. <html> <head> <script type="text/javascript"> function setCheckedValue(radioObj, newValue) { if(!radioObj)
10
6103
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio button with this link of code: echo 'SCRIPT language=JavaScript setCheckedValue("'.$_SESSION.'");</SCRIPT>'; //? <snip of code>
5
2724
by: swatidesai0407 | last post by:
hi im validating radio buttons i create dis radio button in php based on some how many records of my query. i wrote a javascript to validate this buttons. wat i do is dat wen no radio button are selected it should giv message dat select a radio button. else it should go to other page. My code works fine when there are more than 1 radio button but when only 1 radio button is der dat time it does not work
1
5466
by: Mufasa | last post by:
I have a couple of radio buttons that make various things appear/disappear on the screen through JavaScript. All works great. Problem is I'll click a radio button, something will appear, I reload the page for other reasons and the item disappears. The reason it disappears is I have to set the state initially to invisible so it doesn't show up initially. The radio buttons are html radio buttons not aspx radio buttons so I can have the...
2
1892
vivekgs2007
by: vivekgs2007 | last post by:
Hi i am doing a application that add the rate of the staff evaluation please go through o=it and need help <?php include("../db.php"); session_start(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd" >
0
9072
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
9451
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
9421
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
9333
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
8328
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
6151
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
4942
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3395
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
3
2284
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.