I have the following HTML and jQuery in a Sharepoint .ascx file, trying to validate, for now, just one "required" field (name):
<html>
. . .
<form id="firstform">
<label class="firstblocklabel finaff-webform-field-label">Traveler's name:</label>
<input class="firstblockinput finaff-webform-field-input" type="text" name="travelername" id="travelername" title="Last Name, First Name, Middle Initial" required/>
</br>
. . .
</form>
</html>
<script src="http://ift.tt/1IzeJcy" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$('[id$=firstform]').validate();
});
</script>
...but it doesn't work; entering into the "travelername" input text an exiting it empty, or adding a value then deleting it and exiting, does not invoke a "Please enter a val" or whatever msg it should be, near the "travelername" text input element.
As you can see, "travelername" is tagged as "required", I'm referencing the validate plugin, and I'm calling validate() in the ready function.
Do I also need to add a reference to a .CSS file?
Note: I also tried this url:
...but that also does not work.
Note that I have a similar question here, but in this case I'm not using any code-behind, so it should be simpler to get this working.
Aucun commentaire:
Enregistrer un commentaire