Jquery validation for a custom form -


In a webpage, I am using a form that displays an upload file input or text input based on the current tab selection. Does.

Since I am using the same form for both tabs, the validation of jQuery is failing. I am using both text input and fileinput for verification, but if the form has text input and no reports, then this file has not been submitted. I think because after submitting it, the verifier is also looking for the report that does not exist

Ex:

  Rules: {"textInput": "Required "," Report file ": {required:" true ", accept:" pdf "}},    

I can see what you are talking about, " Similar for both tabs ", etc., because you want us to show any part of that code Have failed Where is the HTML for the form, at least?

However,

It works perfectly well on a form of these two areas ...

  Rules: {"textInput" : "Required", "Report file": {Required: true, // & lt; - Remove the quotation marks by rightly accepting: "pdf"}},   

HTML :

  & lt; Form ID = "MyForm" & gt; & Lt; Input type = "text" name = "textInput" /> & Lt; Input type = "file" name = "reportfile" /> & Lt; Input type = "submit" / & gt; & Lt; / Form & gt;   

Demo:

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

c# - Add Image in a stackpanel based on textbox input -

java - Reaching JTextField in a DocumentListener -