I have a block of custom length fields and a rule to figure them and put the correct total in the cart however I want to hide the div that contains them unless the exact lengths checkbox is checked

Exact Lengths Needed Image

however currently this always shows on my test site and from how the site is set up now with a paragraph of instructions and a textbox i've found that people are lazy and don't read directions. so I don't want to give anyone the opportunity to fill in fields without the checkbox checked

I have tried using JS_Injector to add some js to hide and show but it only seems to be able to add js to the header or footer which doesn't help me add it to the form on the checkbox change event does anyone have any other suggestions short of telling me to write a module with a hook_form_alter()?


I think the Conditional Fields module should do the job.

It allows you to create rules to hide or show fields based on another fields value - so perfect for you.

  • this will work even if I can't hide and show the div with it and have to do the fields individually – mcgyvrfan121 Mar 28 '14 at 15:08
  • Yes, you will have to do the fields individually but will still work... – Felix Eve Mar 28 '14 at 15:16
  • yea I already tried it and I have to change the header on my div but it still accomplishes what I want it to Thank You – mcgyvrfan121 Mar 28 '14 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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