I am attempting to validate four different areas in the last two behaviors behave correctly, but The first two do not work (they should only be necessary). If I submit without entering anything, then only the last two fields show errors.
The question here is jQuery:
$ ("# advertise.post"). Validate: (Required: true, phone: true}, advEmail: {required: truth, email: true}}, message: (validate: true, true), advname: {required: correct}, adname: {required: true} {AdvRetailerName: {Required: "This is necessary."}, Adnom: {Required: "It is necessary."}, Adophone: {Required: "This is required.", Phone: "This is an invalid phone number."} , AdvEmail: {Required: "This is required", email: "This is an invalid email"}}}); Here is the real form:
form action = "php / advertise.post.php" method = "post" id = "advertisepost" Gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; Td> Name of retailer & lt; / Td> & Lt; Td> & Lt; Input type = "text" id = "advRetailerName" name = "advRetailerName" class = "required" /> & Lt; Br / & gt; & Lt; Label = "AdvRetailerName" class = "error" generated = "true" & gt; & Lt; / Label & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> Your name & lt; / Td> & Lt; Td> & Lt; Input type = "text" id = "advName" name = "advName" class = "required" /> & Lt; Br / & gt; & Lt; Label = "adam" class = "error" generated = "true" & gt; & Lt; / Label & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> Phone number & lt; / Td> & Lt; Td> & Lt; Input type = "text" id = "advPhone" name = "advPhone" class = "required" /> & Lt; Br / & gt; & Lt; Label = "adfone" class = "error" generated = "true"> gt; & Lt; / Label & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> Email address & lt; / Td> & Lt; Td> & Lt; Input type = "text" id = "advEmail" name = "advEmail" class = "required" /> & Lt; Br / & gt; & Lt; Label = "AdvEmail" class = "error" generated = "true" & gt; & Lt; / Labels & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt; & Lt; Input type = "button" value = "submit" id = "advsubmit" /> & Lt; / Form & gt; I also tried to add the required class to each area. I know that it is neither to deal with a message-problem or the validation rules are not followed in the first two areas. Any help?
Try it like this
$ Validator AddClassRules ({advPhone: {Required: true, phone: true}, advEmail: {Required: true, email: true}}); Valid for $ ("# AdvertisePost"). Then add the required class for the first two
Alternatively you can make a valid line and add class emails and require the last two
Comments
Post a Comment