0

I am using drupal commerce for my client ecommerce site. For shipping methods I am using commerce_shipping, commerce_ups, commerce_usps.

Everything is working but my client wants when a user select any ups shipping service a textbox should be shown and should be required.

What I have done till now :

I have created a pane which contains a textbox using order setting. And that taexbox is showing on checkout form . But when I make this textbox as a required field than it is not possible to submit the form when user select usps or flat rate shipping services.

So how I can show a textfield on checkout form which should be required only when user select any ups shippping service.

Thanks!

2

1 Answer 1

0

You could try to do this via #states property in form API.

More information about that can be found here: How to make a form required with states?

Personally i only used it to hide/display form elements, but required/non-required should be possible as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.