Preselect Radio Buttons on signup.php

Discussion in 'Templates customization' started by moounttr, Dec 17, 2010.

  1. moounttr

    moounttr New Member

    Joined:
    Oct 20, 2010
    Messages:
    5
    Hi,

    I have two radio buttons on the sign up page. I need one of the radio buttons to be checked by default.

    How do i go about implementing it?

    Any help would be greatly appreciated

    Thanks!
  2. moounttr

    moounttr New Member

    Joined:
    Oct 20, 2010
    Messages:
    5
    Can anyone help with this:confused:

    Urgent help needed.

    Thank you!!
  3. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
  4. moounttr

    moounttr New Member

    Joined:
    Oct 20, 2010
    Messages:
    5
    Hi Alex

    Thanks for your reply! I think i got it.
  5. moounttr

    moounttr New Member

    Joined:
    Oct 20, 2010
    Messages:
    5
    Hi,

    is there anyway we can do this by modifying the form and not linking with an id?
  6. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Add this to the top of signup.php:
    PHP:
    if(!$_GET[product_id]) {
    $_REQUEST[product_id] = $_GET[product_id] = 1// 1 is a number of product that should be selected
    }
  7. plannerguy

    plannerguy aMember Pro Customer

    Joined:
    Jul 13, 2012
    Messages:
    14
    For anyone trying to pass parameters via URL to a signup form to preselect a product (using radio buttons brick) here's what worked for me:
    http://www.example.com/signup/formname?product_id_page-0[]=17-24

    If you inspect the code of the radio buttons, you'll find a name="some_code" and value="some-value"on the input tag:
    eg:
    Code:
    <input type="radio" id="product-17-24" name="product_id_page-0[]" value="17-24" data-first_price="125.00" data-second_price="125.00" checked="checked">
    Just pass whatever is in the name= in the url. What you find in the value= goes after.

    Where this is really useful.
    Instead of having to create 3 forms now, you can use the same form, but users will see a different product selected based on the url parameters you pass.
    Enjoy!

    Pg

Share This Page