Jump to content

Radio button checked state


Recommended Posts

I changed the "Guest checkout" and "Create an account" buttons in the OPC order-opc-new-account.tpl to radio buttons, leaving the same id (#opc_guestCheckout and #opc_createAccount). It is working fine for switching the visibility of the fields like the original buttons did, however the initial "checked" state is wrong; when the page first loads, the fields for "Create an account" are shown but the radio for "Guest checkout" shows a checked state. Also uniform.js is wrapping the input in a span with a checked class. How would I have to go about making the checked state display correctly depending on which form fields are shown?

Link to comment
Share on other sites

I finally made it work after changing in order-opc.js a click event to a change event e.g.

$(document).on('click', '#opc_guestCheckout', function(e){.....

to

$('#opc_guestCheckout').change( function(e){....

 

at least for now it is working. If anybody would know that there would be a better way, the "Prestashop" way to handle radio buttons, please write a comment.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...