Problem with required and dependant fields

fkb 24 Nov, 2016
Hi,

I just created 2 new forms:

http://tuinhuizenfabrikant.be/en/horse-dogline#quotation-horseline
http://tuinhuizenfabrikant.be/en/horse-dogline#quotation-dogline

They are copies of this form, cause I know this one works as it should:

http://tuinhuizenfabrikant.be/nl/garageline

and then I edited the fields that should be different. + Made some changes to the admin and user mails. But that's all I did.

PROBLEM 1:

When testing I noticed that the required fields don't seem to work. For example Country, location, street... are all set to "required" but you can just leave them open and submit the form.

PROBLEM 2:

I made some fields dependant to others. For example when you choose standard wood type "PineWood" it should show the standard "Woodthickness" field, but hide the field "WoodthicknessCedar". When you choose Wood Type "Cedar" , it should enable "WoodthicknessCedar", cause Cedar is only available in 18mm, and hide the other one.

But it doesn't work in my new forms. When I choose Cedar it keeps showing the standard wood thicknesses.

And in the admin mail and user mail it shows both "WoodthicknesCedar" and "Woodthickness". But normally when you choose Pine Wood, it should disable and hide WoodthicknessCedar (this works as it should in the original Garageline quotation request form):

Woodtype: {Woodtype}
Wood thickness: {Woodthickness}{WoodthicknessCedar}

Woodtype: Pine wood
Wood thickness: 18mm 18 mm

Can you have a look please? I made an account for you
thanks

This is private content

GreyHead 24 Nov, 2016
Hi den_dhaeze,

I don't see exactly what the problem is but I suspect that it may be because you have two forms on the same page with the same names and - more importantly - ids. element IDs should be unique.

If you look at one of the forms without the template - or the second form, then the validation works correctly

This is private content



I don't see any validation errors on the page so my best guess is that the duplicate IDs are somehow confusing the validation code.

I'd suggest that you test with a couple of very simple forms in tabs to see if this is correct.

Bob
This topic is locked and no more replies can be posted.