How to fix positioning error with jQuery Validation Engine and Twitter Bootstrap modals

南笙酒味 提交于 2019-12-22 04:27:04

问题


I am using Twitter Bootstrap 2.1.0 on my site, I am also using the jQuery Validation Engine 2.6.2 plugin, which these work well together.

Until you try to use the validation engine in a modal:

Notice how we get a horizontal scroll bar, and the message gets cut off?

I am wondering what I can do to fix this?


回答1:


You can establish a default position for the error messages when you instantiate/update validationEngine, which will apply to all your validated fields:

$("#formID1").validationEngine({promptPosition : "topRight:-100"});

and/or setup individual position settings for each of your fields:

<input type="text" class="validate[required]" data-prompt-position="bottomRight:-100" />



回答2:


<script type="text/javascript">
    $(function () {
        $("#form1").validationEngine('attach', { promptPosition: "topLeft" });
    });
    function RValidate() {
        $("#form1").validationEngine('detach');
    }

</script>



回答3:


Search the below code in jquery.validationEngine.js

 if (options.isOverflown)
     field.before(prompt);
 else
     $("body").append(prompt);

replace it with

 //if (options.isOverflown)
     field.before(prompt);
 //else
     //$("body").append(prompt);


来源:https://stackoverflow.com/questions/14560965/how-to-fix-positioning-error-with-jquery-validation-engine-and-twitter-bootstrap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!