Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jan 2011
    Posts
    136
    Thanks
    101
    Thanked 0 Times in 0 Posts

    how to keep radio button pushed

    I am trying to add a set of radio buttons to my html form:

    What is your gender : <br />
    <input type="radio" name=gender value="m"> male <br>
    <input type="radio" name=gender value="f"> female<br>

    My code uses the following sentence to pass variables back and forth. The below code works great for any direct input, but not for radio buttons. If the users click back to edit, the previous radio button value will be lost.

    $p->var('Eradio1', $q->escapeHTML($qv->{Eradio1})) if $qv->{Eradio1};

    Is there a way I can get around this?

    Thank you.

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by camaross View Post
    I am trying to add a set of radio buttons to my html form:

    What is your gender : <br />
    <input type="radio" name=gender value="m"> male <br>
    <input type="radio" name=gender value="f"> female<br>

    My code uses the following sentence to pass variables back and forth. The below code works great for any direct input, but not for radio buttons. If the users click back to edit, the previous radio button value will be lost.

    $p->var('Eradio1', $q->escapeHTML($qv->{Eradio1})) if $qv->{Eradio1};

    Is there a way I can get around this?

    Thank you.
    i'm not sure but this is in confirm sub? the values are passed using hidden fields:

    Code:
    $p->var('HIDDENS', hiddens( { 
        Efromname   => $qv->{Efromname}, 
        Efromemail  => $qv->{Efromemail}, 
        Esubject    => $qv->{Esubject}, 
        Etitle      => $qv->{Etitle},
        Eradio1 => $qv->{Eradio1},
        Emessage    => $qv->{Emessage},
        Referer     => $qv->{Referer}
        } ));
    adding the yellow line could solve the problem but i'm not sure.

    best regards

  • Users who have thanked oesxyl for this post:

    camaross (04-04-2011)

  • #3
    Regular Coder
    Join Date
    Jan 2011
    Posts
    136
    Thanks
    101
    Thanked 0 Times in 0 Posts
    Hi Oesxyl,

    Sorry for the late reply. I was out for today.

    Yes, I tried to add it in the hidden value, but it is not working either. I might just change the radio button to a regular text field to make it easier.

    I appreciate your quick reply very much

    Cheers.


    Quote Originally Posted by oesxyl View Post
    i'm not sure but this is in confirm sub? the values are passed using hidden fields:

    Code:
    $p->var('HIDDENS', hiddens( { 
        Efromname   => $qv->{Efromname}, 
        Efromemail  => $qv->{Efromemail}, 
        Esubject    => $qv->{Esubject}, 
        Etitle      => $qv->{Etitle},
        Eradio1 => $qv->{Eradio1},
        Emessage    => $qv->{Emessage},
        Referer     => $qv->{Referer}
        } ));
    adding the yellow line could solve the problem but i'm not sure.

    best regards

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by camaross View Post
    Hi Oesxyl,

    Sorry for the late reply. I was out for today.

    Yes, I tried to add it in the hidden value, but it is not working either. I might just change the radio button to a regular text field to make it easier.
    is possible to be a problem of on/off, i mean the variable is not passed, is undefined, when the radio is not checked.

    I appreciate your quick reply very much
    speed is matter of context,

    best regards


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •