Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Dynamic Disabling Required fields

BrownZeus
 Share

Hey all,

 

So I have a form with a Delivery Info field.

 

If the billing address and the delivery address is the same, the user checks a box.

 

Right now, aforementioned box hides the delivery address fields using a a JS onclick script, however these fields are also required.

Because of this, one will not be able to submit the form.

 

So, how do I make my delivery fields required, but not required when hidden. For whatever reason changing my script to disable these fields instead of hiding them, isn't working.

 

This page is being developed with PHP as the serverside language.

 

TIA!!

Link to comment
Share on other sites

Link to post
Share on other sites

In your onclick also copy the data to the delivery form fields.

 

Or on the back end check if the button is true and then copy the data then.

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
Share on other sites

Link to post
Share on other sites

On 12/29/2018 at 11:40 AM, vorticalbox said:

In your onclick also copy the data to the delivery form fields.

 

Or on the back end check if the button is true and then copy the data then.

 

On 12/29/2018 at 11:44 AM, Mira Yurizaki said:

Check if the button is true, then copy the data into whatever data structure you're using for the delivery address data before submitting it to the server.

 

Would advise to do this on the client side to avoid giving the server extra work.

Thanks for the tips guys

 

Much appreciated

Link to comment
Share on other sites

Link to post
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
 Share


×