I am using Position Absolute’s Validation Engine for validating values on form.
The issue is that on validation, the error prompts do not appear attached to the textboxes (input type:text) as they are expected. I know that the issue is with the margin-top that I have given to the textboxes but I cannot change that. Sample code snippet is provided here…
html:
<form id="frmTest" style="position:relative">
<div id="divContents" style="position:relative; overflow-y:auto; overflow-x:none;">
<div class="row1">
<span>FName:</span>
<input id="txtFName" data-prompt-position="bottomRight" class="validate[required] text-input" tabindex="1" />
</div>
<div class="row2">
<span>LName:</span>
<input id="txtLName" class="validate[required] text-input" tabindex="2" />
</div>
<div class="row3">
<span>Age:</span>
<input id="txtAge" class="validate[required, custom[integer],min[1]] text-input" tabindex="3" />
</div>
</div>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<input type="submit" id="btnSubmit" value="Submit" />
</form>
JS:
$('#frmTest').validationEngine();
$('#txtFName').focus();
$('#btnSubmit').click(function(){
return $('#frmTest').validationEngine();
});
The divs that I have created are just sample but in live environment, they are collapsible divs. Also, I don’t want to hard-code data-prompt-position value for each input field as there are more than 100 fields in each form. So am looking for a generic way of handling this issue (which I know is possible through CSS but don’t know how?)
The demo setup having the issue is on http://www.x-lant.com
Use guest / pwd to login to the application.
I just used this code in js
and this in css
and it looks good.
The updated fiddle is here.
I hope this helps you.
HTML
CSS
JS
Also, more documentation here.