Way to require quantity if checkbox is selected

Melissa B created the topic: Way to require quantity if checkbox is selected

Hello! I would like to be able to require a quantity to be filled in if a checkbox is selected. This isn't able to be done via "required" since that only requires the checkbox be picked, and doesn't require the quanity field. I tried adding the following to the Javascript on the Form Options, but no luck. Any suggestions? Thanks!!

if (((document.form14.wdform_41_element140.checked) && (document.form14.wdform_41_element_quantity14 <=0)))
{

alertmsg = alertmsg + "Please enter Quantity" +"\n";
return true;

}

#81673

Please Log in or Create an account to join the conversation.


Agapi G. replied the topic: Way to require quantity if checkbox is selected

Hello Melissa! Thank you for posting your question!

Could you please give us the link to the page where you have published your form? We will check the Javascript code and see why it isn't applying your changes.
Thanks! Have a good day!


Kind regards,
Agapi G.
Web-Dorado team
#81745

Please Log in or Create an account to join the conversation.


Melissa B replied the topic: Way to require quantity if checkbox is selected

I'm sorry I haven't revisited this sooner, now it's an issue again - I was able to work around this, by making the quantity 0 to start, however, now people are entering the quantity (i.e. 1-9, etc) and NOT checking the checkbox which means they don't get charged for the item. So now I need javascript that would make the checkbox active if anything is typed into the quantity boxes. Any ideas? Thanks very much. The link is safariclubpittsburgh.org/registration-fo...17-gala-2-day-event/

#84827

Please Log in or Create an account to join the conversation.


Melissa B replied the topic: Way to require quantity if checkbox is selected

HEre's the code entered..

if (document.form14.wdform_41_element170.checked === false && document.form14.wdform_41_element_quantity17 >=0)
{

document.form14.wdform_41_element170.checked=true;

}

#84835

Please Log in or Create an account to join the conversation.


Agapi G. replied the topic: Way to require quantity if checkbox is selected

Hello Melissa!

The code you wrote is correct, but it won't work until you add it either into before_submit() or with .change() function. If you decide to go with jQuery .change(), let me give you the link to its manual, where you will find examples and code syntax:

api.jquery.com/change/

Let us know if you have further questions.
Thanks! Have a nice day!


Kind regards,
Agapi G.
Web-Dorado team
#84895

Please Log in or Create an account to join the conversation.


Melissa B replied the topic: Way to require quantity if checkbox is selected

Thanks for your response, but it already was in the before_submit() function and nothing happens when you click submit.

#84915

Please Log in or Create an account to join the conversation.


Agapi G. replied the topic: Way to require quantity if checkbox is selected

Hey Melissa!

Could you please check my reply to your second forum topic?
I have provided further details there, you can find it within the following link: goo.gl/2F7MWp

Thanks! Have a wonderful day!


Kind regards,
Agapi G.
Web-Dorado team
#84957

Please Log in or Create an account to join the conversation.


Time to create page: 0.201 seconds
Powered by Kunena Forum

WORLD-CLASS SUPPORT

We are here for you every step of the way. Turn to our support with any questions you might have about our products and services. Our experienced customer care team is available to help you as fast as we possibly can.

Contact us