cancel
Showing results for 
Search instead for 
Did you mean: 

How can I show/hide frontend forms based on condition

SOLVED

How can I show/hide frontend forms based on condition

I'm migrating to Magento 2 from another system. We're asking customers to re-register.

 

Instead of showing the default signup form when they get to the /account/create page, I want to have the form hidden, and have 2 radio buttons there asking if they're a new customer or existing customer.

 

I created the radio buttons as a ui component, but logic in ui components is done with ko.js, and I can't use php in the component for logic.

 

How can I show or hide the register form based on changing the radio button?

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How can I show/hide frontend forms based on condition

@media_bloke 

 

you can write simple jquery and you can do it

 

https://amasty.com/knowledge-base/what-is-jquery-and-how-to-use-it-in-magento-2.html

 

above url useful to add jQuery code into ptml file

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

View solution in original post

1 REPLY 1

Re: How can I show/hide frontend forms based on condition

@media_bloke 

 

you can write simple jquery and you can do it

 

https://amasty.com/knowledge-base/what-is-jquery-and-how-to-use-it-in-magento-2.html

 

above url useful to add jQuery code into ptml file

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer