The form validation framework in my preside app doesn’t work.
What I do:
I have a form.xml with a field definition
<field name="title" sortorder="0" control="textinput" required="true" />
I render the form in my view:
#renderForm(
formName = "newsfeed.edit"
, context = "website"
, formId = "editPM"
, includeValidationJs = true
, fieldLayout = "newsfeed.fieldLayout"
)#
I see, that the rules are generated:
<script type="text/javascript">
( function( $ ){
var validator = $('#editPM').validate()
, options = ( function( $ ){ return { rules : { "title" : { "normalizer" : function(value) { return $.trim(value); }, "required" : { param : [] } } }, messages : { "title" : { "required" : "Erforderliches Feld" } } }; } )( jQuery );
validator.settings.rules = $.extend( validator.settings.rules , options.rules );
validator.settings.messages = $.extend( validator.settings.messages, options.messages );
} )( jQuery );
</script>
But the validation doesn’t work. I can just submit the form. What am i missing here? Looks like a .js is missing (where I thought it is automatically included when includeValidationJs = true
is set).
Any advice here?