Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 29th, 2003, 12:20 AM
Authorized User
 
Join Date: Jun 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to tgopal
Default Passing Parameter

I have two radio buttons and an hyperlink in my form. when i am clicking the hyperlink i want to pass an value to the form, to indicate which radio button is selected.I don't want to submit the form because i am opening the form as an popup.
is there a way to do it.Please provide some sample code
Thanks
T.Gopalakrishnan
 
Old July 29th, 2003, 04:02 AM
Authorized User
 
Join Date: Jun 2003
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to planeswalk
Default

Hi,

Sounds a little confusing : do you want to click one of the radio buttons first before you click on the hyperlink?

Cheers!
Marlon
 
Old July 29th, 2003, 04:16 AM
Authorized User
 
Join Date: Jun 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to tgopal
Default

Hai
Sorry for the confusion.i am first going to select an radio button after that i am going to click on the hyperlink.While clicking the hyperlink i want to pass which radio button is selected as an parameter to the form.
Thanks
T.Gopalakrishnan
 
Old August 7th, 2003, 07:54 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 101
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Moharo
Default

you might want to do something like this:


<form name="myform">
<input type="radio" name="myradio" value="1">1
<input type="radio" name="myradio" value="2">2
</form>

<a href="javascript:readAndSend();">Send it</form>

<script language="JavaScript">

var selection = null;

function readAndSend() {
    for(i=0;i<document.getElementById("myform").elemen ts.length;i++) {
        if(document.getElementById("myform").elements[i].type == "radio") {
             if(document.getElementById("myform").elements[i].checked) {
                  //store the value of a checked radio button
                  selection = document.getElementById("myform").elements[i].value; }
                                                                                 }
                                                                             }
    if(selection != null) window.open('otherpage.html?pick=' + selection);
    else alert("please make a selection");
}

</script>

:):D:D:D

the genuine genius





Similar Threads
Thread Thread Starter Forum Replies Last Post
passing parameter sarah lee ASP.NET 1.0 and 1.1 Basics 3 September 5th, 2006 04:29 PM
problem with passing parameter hertendreef ADO.NET 0 June 23rd, 2006 10:00 AM
Passing a Date Parameter ego_mouse BOOK: Professional Crystal Reports for VS.NET 1 January 27th, 2005 08:12 AM
passing parameter.. suzila VB.NET 2002/2003 Basics 7 May 17th, 2004 08:28 PM
Parameter passing psambor Beginning PHP 0 September 17th, 2003 01:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.