Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Radio Button Checked Value

Posted on 2014-11-13
5
Medium Priority
?
288 Views
Last Modified: 2014-11-17
Hello,
I'm using OpenCart 1.5.5.1 and an extension for one page checkout. I placed a 'login block' on top of the Shopping Cart form and it's elements are still linked to the extension.
Everything Works! except... the 'register' - 'guest checkout' radio buttons won't stay checked after submission. The content of the form refreshes as designed but neither of the radio buttons will stay checked.
Here's the code snippet for the radio buttons:
<p><?php echo $text_checkout; ?></p>  
  <?php $i = 0; ?>
    <?php if ($i == 0 && !$customer_logged && $simple_customer_action_register == Simple::REGISTER_USER_CHOICE) { ?>
                <tr>
                    <td class="simplecheckout-customer-left">                       
                    </td>                    
<td class="simplecheckout-customer-right">
                      <label><input type="radio" name="register" value="1"<?php echo $register == 1 ? 'checked="checked"' : '' ; ?>reload="customer_register" /><b><?php echo $text_yes ?></b>&nbsp;<b><?php echo $text_register; ?></b>&nbsp;</label></br>
                      <p><?php echo $text_register_account; ?></p>
                     <label><input type="radio" name="register" value="0"<?php echo $register == 0 ? 'checked="checked"' : '' ; ?>reload="customer_not_register" /><b><?php echo $text_no ?>&nbsp;<?php echo $text_guest; ?></b></label>                    
                     
                    </td> 
                    </tr> 
               <?php $user_choice = true; ?>
            <?php $i++ ?>     

Open in new window


Any code I place within the <label></label> tags stops the reload function.
I'm attaching two files, one is the checkout template (where my new login block is) and one is the customer template which is called by the checkout template.
Thanks in advance for any help you might give.
checkout-tpl.txt
customer-checkout-tpl.txt
0
Comment
Question by:stoneycurtis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 40442409
Can you only try "checked" instead of "'checked="checked"'"?
0
 

Author Comment

by:stoneycurtis
ID: 40442495
Hello Girionis,
1)
<label><input type="radio" name="register" value="1"<?php echo $register == 1 ? "checked" :' '; ?>reload="customer_register" /><b><?php echo $text_yes ?></b>&nbsp;<b><?php echo $text_register; ?></b>&nbsp;</label></br>

Open in new window

Doesn't allow the reload to work.
2 )
<label><input type="radio" name="register" value="1"<?php echo $register == 1 ? "checked"; ?>reload="customer_register" /><b><?php echo $text_yes ?></b>&nbsp;<b><?php echo $text_register; ?></b>&nbsp;</label></br>

Open in new window

Breaks the page entirely, (white screen).
0
 
LVL 28

Accepted Solution

by:
Bill Bach earned 2000 total points
ID: 40442601
Need a space between vale="1" and checked.  As written, both of these create:
   value="1"checked
Add a space after the last double-quote and see if that helps.
0
 

Author Comment

by:stoneycurtis
ID: 40442811
@ Girionis and BillBach
'checked="checked"' is the only way that the reload function will work.
<label><input type="radio" name="register" value="1" <?php echo $register == 1 ? 'checked="checked"' :''; ?>reload="customer_register" /><b><?php echo $text_yes ?></b>&nbsp;<b><?php echo $text_register; ?></b>&nbsp;</label></br>
                      <p><?php echo $text_register_account; ?></p>
                     <label><input type="radio" name="register" value="0" <?php echo $register == 0 ? 'checked="checked"' : ''; ?>reload="customer_not_register" /><b><?php echo $text_no ?>&nbsp;<?php echo $text_guest; ?></b></label>

Open in new window


Thanks for your help
0
 
LVL 35

Expert Comment

by:girionis
ID: 40444186
You should accept billback's comment as answer. You need to leave a space between the value and the "checked" attibute.
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Curious about the latest ransomware attack? Check out our timeline of events surrounding the spread of this new virus along with tips on how to mitigate the damage.
Are you an Exchange administrator employed with an organization? And, have you encountered a corrupt Exchange database due to which you are not able to open its EDB file. This article will explain all the steps to repair corrupt Exchange database.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question