isOverflown decapreated soon (not stable, not easy to use)
The engine will welcome new option soon, static . Static append the prompts after or before the inputs, and override the prompt style to make it position:static (instead of absolute). This will be especially useful in overflown divs, where positioning was becoming difficult without very good knowledge of this script.
Static can't be positioned like the normal mode, but you can easily style them by css.
I hate to deprecate features, but I think it was an evidence that the overflow mode was a fail, for now I will let the isOverflown option, this willl activate the static mode.
Check back in a week or 2 for the commit.
How it going ?
I guess soon is late :P
Great idea, I am currently working on a site that uses a modal dialog from Jquery UI, I tried the overflow didn't work all of the prompts are stuck at the top :(
Hi, In the version of 2.2.4, when to set 'isOverflown' = true,and set ‘OverflownDIV’ = the ID of scrolled div ,you need to wrap the input in a div with relative position like this: .inputContainer{position:relative;float:left;}
<div class='inputContainer'><input type='text' class='validate[required]' /> </div>
In this example,OverflownDIV='.inputContainer'.
When validate the input ,it will append the validation prompt div to the .inputContainer div like this:
<div class='inputContainer'>
<div class='formError'>
<div class='formErrorContent'></div>
<div class='formErrorArrow'></div>
</div>
<input type='text' class='validate[required]' />
</div>
Well,it's no problem in IE6,IE8+,firefox,chrome. But it maybe some problems in IE7,the .inputContainer div will move , when I open a Modal div. Now I changed it like this:
<input type='text' class='validate[required]' />
<div class='wrap'>
<div class='formError'>
<div class='formErrorContent'></div>
<div class='formErrorArrow'></div>
</div>
</div>
The .formError div style: position:absolute, top:..px, left ..px , the top and left calculate like this:
promptTopPosition = offset.top - field.height() - 3 + $(options.overflownDIV).scrollTop();
promptleftPosition = offset.left;
The .wrap div append by the validationEngine,no need to wrap the input manually. It seems all right in IE6+、firefox、chrome.
I was able to address this problem with a small change to the source code:
change line: field.before(prompt); to: field.before(prompt.addClass('overflown'));
Then you can modify CSS to use different behavior for formError.overflown. Specifically, .formError.overflown { position: relative; }
Yes, my approach is similar to you. I change to :
if (options.isOverflown) {
if (!prompt.parent().find('.wrap').length > 0)
prompt.wrap("<div class='wrap'></div>");
field.before(prompt.parent());
}
It will wrap the input automatically,with
<div class='wrap'></div>
yea the approach I wanted to take is similar to will-lu
By the way, the _calculatePosition function has to changed
var overflow = options.isOverflown;
if (overflow) {
// is the form contained in an overflown container?
promptTopPosition = promptleftPosition = 0;
// compensation for the arrow
marginTopSize = -promptHeight;
}
to:
var overflow = options.isOverflown;
if (overflow) {
var offset = field.offset();
promptTopPosition = offset.top + $(options.overflownDIV).scrollTop() - 25;
promptleftPosition = offset.left;
marginTopSize = 0;
}
latest commit bring a new option relative, which is not what I intended as a replacement, but still a better solution, i unfortunately have less and less time for this project and for the near future relative will do