Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2013
    Location
    United States
    Posts
    37
    Plugin Contributions
    0

    Default Radion Button Checked for Contact Page

    Hello,

    I've customized my Contact page with additional fields (here is a great link for instructions on that - http://www.zen-cart.com/showthread.p...ontact-us-form) and have added some radio buttons. I have four items to select from - Architect, Consumer, Designer, Purchasing Agent. It seems by default Purchasing Agent is always selected - I want to keep this list alphabetical but have Consumer be the one that is selected...how can I do that? Sorry I can't share the link to the store yet (in development).

    Here is part of the code from the tpl_contact_us_default.php file that has the radio buttons:

    Code:
    <label class="m-wrap" for="job">Occupation:</label>
    <?php echo zen_draw_radio_field('job', 'Architect', 'id="Architect"') . '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Architect' . '<br/>' . zen_draw_radio_field('job', 'Consumer', 'id="Consumer"'). '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Consumer' . '<br/>' . zen_draw_radio_field('job', 'Designer', 'id="Designer"'). '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Designer' . '<br/>'  . zen_draw_radio_field('job', 'Purchasing Agent', 'id="Purchasing"'). '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Purchasing Agent' . '<br/>' ?>
    <br class="clearBoth" /><br/>

  2. #2
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Radion Button Checked for Contact Page

    Quote Originally Posted by eyeb View Post
    Hello,

    I've customized my Contact page with additional fields (here is a great link for instructions on that - http://www.zen-cart.com/showthread.p...ontact-us-form) and have added some radio buttons. I have four items to select from - Architect, Consumer, Designer, Purchasing Agent. It seems by default Purchasing Agent is always selected - I want to keep this list alphabetical but have Consumer be the one that is selected...how can I do that? Sorry I can't share the link to the store yet (in development).

    Here is part of the code from the tpl_contact_us_default.php file that has the radio buttons:

    Code:
    <label class="m-wrap" for="job">Occupation:</label>
    <?php echo zen_draw_radio_field('job', 'Architect', 'id="Architect"') . '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Architect' . '<br/>' . zen_draw_radio_field('job', 'Consumer', 'id="Consumer"'). '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Consumer' . '<br/>' . zen_draw_radio_field('job', 'Designer', 'id="Designer"'). '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Designer' . '<br/>'  . zen_draw_radio_field('job', 'Purchasing Agent', 'id="Purchasing"'). '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Purchasing Agent' . '<br/>' ?>
    <br class="clearBoth" /><br/>

    try:
    <?php echo zen_draw_radio_field('job', 'Architect', '', 'id="Architect"') . '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Architect' . '<br/>' . zen_draw_radio_field('job', 'Consumer', $checked = true, 'id="Consumer"'). '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Consumer' . '<br/>' . zen_draw_radio_field('job', 'Designer', '', 'id="Designer"'). '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Designer' . '<br/>' . zen_draw_radio_field('job', 'Purchasing Agent', '', 'id="Purchasing"'). '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Purchasing Agent' . '<br/>' ?>

  3. #3
    Join Date
    Aug 2013
    Location
    United States
    Posts
    37
    Plugin Contributions
    0

    Default Re: Radion Button Checked for Contact Page

    Sorry about the title...Radio Button, of course.

    I have a follow up question too - is there way so that NO option is selected as the default?

  4. #4
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Radion Button Checked for Contact Page

    Quote Originally Posted by eyeb View Post
    Sorry about the title...Radio Button, of course.

    I have a follow up question too - is there way so that NO option is selected as the default?
    try:
    <?php echo zen_draw_radio_field('job', 'Architect', '', 'id="Architect"') . '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Architect' . '<br/>' . zen_draw_radio_field('job', 'Consumer', '', 'id="Consumer"'). '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Consumer' . '<br/>' . zen_draw_radio_field('job', 'Designer', '', 'id="Designer"'). '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Designer' . '<br/>' . zen_draw_radio_field('job', 'Purchasing Agent', '', 'id="Purchasing"'). '&nbsp;&nbsp;&nbsp;&nbsp;'. 'Purchasing Agent' . '<br/>' ?>

  5. #5
    Join Date
    Aug 2013
    Location
    United States
    Posts
    37
    Plugin Contributions
    0

    Default Re: Radion Button Checked for Contact Page

    Thanks for the reply Rbarbour - didn't work - nothing changed.

  6. #6
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Radion Button Checked for Contact Page

    Quote Originally Posted by eyeb View Post
    Thanks for the reply Rbarbour - didn't work - nothing changed.
    Zen function for radio buttons:

    function zen_draw_radio_field($name, $value = '', $checked = false, $parameters = '') {

    so leaving '', should auto return false on those radio buttons.

    I tried and it worked on my dev site,

    I also tried changing true to false and that worked - none were selected

    Even changed $checked = false to just 'true', - and that worked
    Last edited by rbarbour; 1 Oct 2013 at 04:58 PM. Reason: attempts on dev site

  7. #7
    Join Date
    Aug 2013
    Location
    United States
    Posts
    37
    Plugin Contributions
    0

    Default Re: Radion Button Checked for Contact Page

    IT WORKED...thanks. My apologies - I didn't see that you had also included the '', for the other entries too -- AND it also worked to show none of them selected. Great stuff...thanks again!

  8. #8
    Join Date
    Feb 2010
    Posts
    2,159
    Plugin Contributions
    17

    Default Re: Radion Button Checked for Contact Page

    Quote Originally Posted by eyeb View Post
    IT WORKED...thanks. My apologies - I didn't see that you had also included the '', for the other entries too -- AND it also worked to show none of them selected. Great stuff...thanks again!
    Glad you got it working!

 

 

Similar Threads

  1. Showroom Only- Button for Contact Us
    By Decostyle in forum Templates, Stylesheets, Page Layout
    Replies: 11
    Last Post: 23 Jun 2010, 06:41 PM
  2. Getting the default attribute radio button checked
    By John Luciani in forum Setting Up Categories, Products, Attributes
    Replies: 13
    Last Post: 3 Nov 2009, 07:19 PM
  3. radio button checked when shouldn't be
    By domsmom in forum Setting Up Categories, Products, Attributes
    Replies: 7
    Last Post: 5 Jun 2009, 04:51 PM
  4. HOW TO? radio button checked or won't proceed through checkout?
    By blackpig in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 9 Dec 2008, 09:24 PM
  5. Button to Contact Us in Product Page
    By moke in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 7 Nov 2008, 05:55 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR