Skip to content

Commit ebc3f5b

Browse files
committed
Merge pull request #680 from SamJBarney/master
Fixed Custom Messages section of Documentation
2 parents 99ea7d3 + 0a5ce95 commit ebc3f5b

19 files changed

+2796
-152
lines changed

README.md

100755100644
Lines changed: 32 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,8 @@ Prompt direction can be define using the field's **data** attribute. Here are a
144144
<input value="http://" class="validate[required,custom[url]] text-input" type="text" name="url" id="url" data-prompt-position="topLeft" />
145145
<input value="" class="validate[required] text-input" type="text" name="req" id="req" data-prompt-position="bottomLeft" />
146146
<input value="too many spaces obviously" class="validate[required,custom[onlyLetterNumber]]" type="text" name="special" id="special" data-prompt-position="bottomRight" />
147-
<input value="" class="validate[required] text-input" type="text" name="req-inline" id="req-inline" data-prompt-position="inline" />
148147
```
149148

150-
If "inline" is applied the prompt is attached after the corresponding input field with position set to "relative". You can specify an optional target container to which the prompt should be attached by providing the id of this container in the field's **data-prompt-target** attribute.
151-
152149
### Prompt Position Adjustment
153150

154151
Prompt position can be adjusted by providing shiftX and shiftY with position type in the field's **data** attribute.
@@ -211,26 +208,6 @@ All calls to validationEngine() are chainable, so one can do the following:
211208
$("#formID").validationEngine().css({border : "2px solid #000"});
212209
```
213210

214-
### Suppress Validation Feature
215-
216-
Hyperlink and Button ( <button> and input ) allow suppress the validation for special case such as multi fake submit buttons in web page.
217-
An id attribute for the HTML element is required.
218-
219-
Syntax (HTML5):
220-
```html
221-
<input id="skipbutton" data-validation-engine-skip="true" type="submit" value="Refresh button"/>
222-
```
223-
Syntax (use class attribute):
224-
```html
225-
<input id="skipbutton" class="submit validate-skip" type="button" value="Refresh button"/>
226-
```
227-
228-
### Using a DIV container instead of a FORM
229-
230-
You can use a div acting as a container using the class *"validationEngineContainer"*. Please be aware that events like submit() won't work and you will have to call the action 'validate' to validate the form.
231-
232-
233-
234211
Actions
235212
---
236213

@@ -244,7 +221,7 @@ $("#formID1").validationEngine('attach');
244221

245222
### detach
246223

247-
Unregisters any bindings that may point to jQuery.validationEngine.
224+
Unregisters any bindings that may point to jQuery.validaitonEngine.
248225

249226
```js
250227
$("#formID1").validationEngine('detach');
@@ -274,7 +251,7 @@ Displays a prompt on a given element. Note that the prompt can be displayed on a
274251
The method takes four parameters:
275252
1. the text of the prompt itself
276253
2. a type which defines the visual look of the prompt: 'pass' (green), 'load' (black) anything else (red)
277-
3. an optional position: either "topLeft", "topRight", "bottomLeft", "centerRight", "bottomRight", "inline". Defaults to *"topRight"*
254+
3. an optional position: either "topLeft", "topRight", "bottomLeft", "centerRight", "bottomRight". Defaults to *"topRight"*
278255
4. an optional boolean which indicates if the prompt should display a directional arrow
279256

280257
```html
@@ -336,24 +313,16 @@ Name of the event triggering field validation, defaults to *blur*.
336313
### scroll
337314
Determines if we should scroll the page to the first error, defaults to *true*.
338315

339-
### scrollOffset
340-
The amount to offset the scroll in px. Useful if there are fixed elements at the top of the page.
341-
342316
### binded
343-
If set false, does not attach blur events and only validates on the form submit.
317+
If set to true, it remove blur events and only validate on submit.
344318

345319
### promptPosition
346-
Where should the prompt show? Possible values are "topLeft", "topRight", "bottomLeft", "centerRight", "bottomRight", "inline". Defaults to *"topRight"*. Default position adjustment could also be provided.
347-
"topLeft" to "bottomRight" are absolutely positioned.
348-
If "inline" is applied the prompt is attached after the corresponding input field with position set to "relative". By adding an optional "data-prompt-target" attribute to the field you can specify the id of an element to which the prompt should be appended alternatively. (see "Per Field Prompt Direction" for more details)
320+
Where should the prompt show? Possible values are "topLeft", "topRight", "bottomLeft", "centerRight", "bottomRight". Defaults to *"topRight"*.
321+
Default position adjustment could also be provided.
349322

350323
### showOneMessage
351324
Only display the first incorrect validation message instead of normally stacking it. It will follows the validation hierarchy you used in the input and only show the first error.
352325

353-
### showPrompts
354-
If set to false, prompts never show.
355-
356-
357326
### ajaxFormValidation
358327
If set to true, turns Ajax form validation logic on. Defaults to *false*.
359328
Form validation takes place when the validate() action is called or when the form is submitted.
@@ -393,30 +362,31 @@ messages or ID messages.
393362
These custom messages are declared in this manner:
394363
```js
395364
jQuery("#formID2").validationEngine({'custom_error_messages' : {
396-
'#someId' : {
397-
'required': {
398-
'message': "This is a custom message that is only attached to the input with id 'someId' if it
399-
has the validation of 'required'. This will always display, even if it has other
400-
custom messages."
365+
'#someId' : {
366+
'required': {
367+
'message': "This is a custom message that is only attached to the input with id 'someId' if it
368+
has the validation of 'required'. This will always display, even if it has other
369+
custom messages."
370+
},
371+
'custom[min]': {
372+
'message': "This is a custom message that is only attached to the input with id 'someID' if it
373+
has the validation of 'custom[min[someNumber]]'. This will always display, even if
374+
it has other custom messages."
375+
}
376+
},
377+
'.someClass': {
378+
'equals': {
379+
'message': "This is a custom message that is only attached to inputs that have the class of
380+
'someClass' and the validation type of 'equals'. This will be displayed only on
381+
inputs without an ID message."
382+
}
383+
},
384+
'required' {
385+
'message': "This is a custom message that replaces the normal error message for the validation
386+
'required'. This only displays when there are no Class or ID messages."
401387
}
402-
,'custom[min]': {
403-
'message': "This is a custom message that is only attached to the input with id 'someID' if it
404-
has the validation of 'custom[min[someNumber]]'. This will always display, even if
405-
it has other custom messages."
406-
}
407-
},
408-
'.someClass': {
409-
'equals': {
410-
'message': "This is a custom message that is only attached to inputs that have the class of
411-
'someClass' and the validation type of 'equals'. This will be displayed only on
412-
inputs without an ID message."
413-
}
414-
},
415-
'required' {
416-
'message': "This is a custom message that replaces the normal error message for the validation
417-
'required'. This only displays when there are no Class or ID messages."
418388
}
419-
}
389+
});
420390
```
421391

422392

@@ -445,10 +415,6 @@ Determines if the prompt should hide itself automatically after a set period. De
445415
### autoHideDelay
446416
Sets the number of ms that the prompt should appear for if autoHidePrompt is set to *true*. Defaults to *10000*.
447417

448-
### addPromptClass
449-
Add a css class to the created prompt on each field (Useful for modals and stuff).
450-
451-
452418
Validators
453419
---
454420

@@ -501,7 +467,7 @@ Please refer to the section *Custom Regex* for a list of available regular expre
501467

502468
### custom[function_name]
503469

504-
Validates the element's value to a predefined function included in the language file (compared to funcCall that can be anywhere in your application),
470+
Validates the element's value to a predefined function included in the language file (compared to funCall that can be anywhere in your application),
505471

506472
```html
507473
<input value="someone@nowhere.com" class="validate[required,custom[requiredInFunction]]" type="text" name="email" id="email" />
@@ -871,14 +837,9 @@ This need to be added before the initialization, one good way to handle this wou
871837
<script src="js/jquery.validationEngine-settings.js" type="text/javascript" charset="utf-8"></script>
872838
```
873839

874-
Using the validationEngine with modal & dialog plugins & kendo UI widgets
840+
Using the validationEngine with modal & dialog plugins
875841
---
876-
Modal elements, have a tendency to take a high z-index, which in turn can interfer with the plugin. In the case of modal jQuery ui, if you want to change the z-index you can do this easily in your css.
877-
878-
.ui-dialog .formError
879-
880-
881-
For other cases please modify the css yourself, we will not support custom frameworks in the base code. You can have more information about implementing the engine with modal views here:
842+
You can have more information about implementing the engine with modal views here:
882843
[http://www.position-absolute.com/articles/using-the-jquery-validation-engine-with-modal-plugins/]
883844

884845

@@ -952,10 +913,5 @@ Authors
952913
---
953914
954915
Copyright(c) 2011 [Cedric Dugas](https://github.com/posabsolute) [http://www.position-absolute.com](http://www.position-absolute.com)
955-
[![endorse](http://api.coderwall.com/posabsolute/endorsecount.png)](http://coderwall.com/posabsolute)
956-
957-
v2.0 Rewrite by [Olivier Refalo](https://github.com/orefalo) [http://www.crionics.com](http://www.crionics.com)
958916
959-
**Official Contributors**
960-
961-
Stefan Fochler
917+
v2.0 Rewrite by [Olivier Refalo](https://github.com/orefalo) [http://www.crionics.com](http://www.crionics.com)

0 commit comments

Comments
 (0)