问题
I make a demo of dynamic form using dorm plugin and insert some validation on that.I just add validation on two fields (user only enter number only first two fields).It works on my fiddle. http://jsfiddle.net/Xe3FG/4/ If user enter string on first field example "foo"and go to next field it display error on right side "Please enter only numbers"
Same code of form when I placed on pop up screen .I am also getting field on the pop up .Field also validate but error message come one left side and label change it position.can we shift position of error text on right side of textfield ? as example on above fiddle? http://jsfiddle.net/HkGAx/22/
$("#testSuiteConfigurationform").validate(validateInputParameters());
function validateInputParameters() {
jQuery.validator.addMethod("onlyNumbers", function(value, element) {
// alert('dd')
return value != "";
}, " Please enter only numbers");
var validation = {
onfocusout : function(element) {
$(element).valid();
},
rules : {
totalRetryCount: { onlyNumbers: true },
totalRepeatCount:{onlyNumbers: true}
},
};
return validation;
};
回答1:
One of the reasons is width of label which is 240px - too many. Also, I've applied float right on error message. Just add this code to your .css styles:
#tabbedPopup label.error {
float: right !important;
}
#tabbedPopup legend.ui-dform-legend {
width: 134px !important;
}
Demo on JSFiddle.
来源:https://stackoverflow.com/questions/23590587/getting-a-label-to-display-on-the-right-side-of-a-form-field