Forums

Validation on Multipler options

ltempest 09 Nov, 2018
Hi,
I have a multiplier set of fields on my form, I have set these fields to required but when the form is completed and these multiplier fields are not filled in the validation does not work and the form is still submitted. How do I use the JS Client side validation to check these fields? I've tried adding the list of multiplier fields:

products[##][product]
products[##][quantity]
products[##][price]
products[##][thickness]
products[##][escalators]

But again this does not work.

Thanks

Lee
healyhatman 09 Nov, 2018
Setting them to "required" should be enough on the client side, although you can't use the square brackets in the ***ID*** of the field (the "name" is fine). For example - working on the form I just threw together on my own site, multiplier and all. If JS validation isn't working, check your console for errors.

In the backend though I don't think the standard "validate fields" action is going to cut it, you're going to want to use a PHP block to loop through $this->data("products") and for each $row, check empty($row["product"]) , empty($row["quantity"]) etc.
This topic is locked and no more replies can be posted.