I have an Entityform and defined dependencies to where if a particular value is selected from one of the drop downs, the resume field (file upload) should be required.

I don't know why, but it's currently not working. It marks the resume field as required, but still lets the application submitted with no error.

I noticed all the required fields (that do work) have a class of required in their markup. Is it possible I can do this in jQuery? Meaning that I check that dropdown and if a certain value is selected, I'll add the required class to the file upload (resume) field.


Javascript can only handle soft (client-side) validation, unless you start looking into AJAX validation.

You need to alter the form on the server side to ensure that the data is validated properly - never rely on JS validation, it should only be used for UI/display purposes, and form data can easily be overridden by the user.

| improve this answer | |
  • I agree, but I just wanted to see if adding a "required" field on the client-side would fix it and if this is a bug with Entityform not adding that class to the file upload field. – farjam Oct 1 '15 at 15:43
  • That wouldn't fix it, unless EntityForm is listening for changes to the classes on that field, and posting back to the server to update the cached form data. What did you use to define the dependencies between fields? Is that part of EntityForm or something else? – Clive Oct 1 '15 at 15:53

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.