Help needed !
On 22 août, 13:13, PanPan <[EMAIL PROTECTED]> wrote: > Have you another idea ?! > > Thanks. > > On 21 août, 17:54, PanPan <[EMAIL PROTECTED]> wrote: > > > But it still doesn't work. > > > On 21 août, 13:59, "Jörn Zaefferer" <[EMAIL PROTECTED]> > > wrote: > > > > That should've been appendTo! > > > > Jörn > > > > On Thu, Aug 21, 2008 at 12:34 PM, PanPan <[EMAIL PROTECTED]> wrote: > > > > > I have tried but it doesn't work. I was thinking it was because of the > > > > synthax error "apentTo", but "apendTo" didn't work at all. > > > > > $(document).ready(function(){ > > > > $("#News").validate({ > > > > rules: { > > > > TitleNews: {required: > > > > true, minLength: > > > > 10}, > > > > IntroNews: {required: > > > > false, minLength: > > > > 150}, > > > > ContentNews: {required: true, > > > > minLength: 200}, > > > > TagsNews: {required: > > > > false, minLength: 5} > > > > }, > > > > messages: { > > > > TitleNews: > > > > { required: "Merci de rentrer un > > > > titre.", > > > > minlength: > > > > "Votre titre doit contenir au > > > > moins 10 caractères !" > > > > }, > > > > IntroNews: {minlength: > > > > "L'intro doit > > > > contenir au moins 150 caractères !"}, > > > > ContentNews: > > > > { required: "Merci de rentrer le > > > > contenu de votre news !", > > > > minlength: "Le > > > > contenu de votre news > > > > doit être au moins de 200 caractères !" > > > > }, > > > > TagsNews: {minlength: > > > > "Le contenu des > > > > tags doit être d'au moins 5 caractères !"} > > > > }, > > > > errorPlacement: function(error, > > > > element) { > > > > var ids = {"TitleNews": "#TitleError", > > > > "IntroNews": "#IntroError"}; > > > > > error.appendTo(ids[element.attr("id")]); > > > > } > > > > }); > > > > }); > > > > > Thanks ! > > > > > On 21 août, 00:16, "Jörn Zaefferer" <[EMAIL PROTECTED]> > > > > wrote: > > > >> Try this: > > > > >> errorPlacement: function(error, element) { > > > >> var ids = { > > > >> "TitleNews": "#TitleError", > > > >> "IntroNews": "#IntroError" > > > >> }; > > > >> error.appentTo(ids[element.attr("id")]); > > > > >> } > > > > >> Insert that at the appropiate place and fill out the other id pairs. > > > >> Let me know if that works. > > > > >> Jörn > > > > >> On Wed, Aug 20, 2008 at 9:35 PM, PanPan <[EMAIL PROTECTED]> wrote: > > > > >> > I'm so sorry but i really don't understand javascript, i use your > > > >> > script to simplify me the validation process of my form. I try many > > > >> > solution but no one works, can you help me ? > > > > >> > I just want to put the error for the #TitleNews input in the > > > >> > #TitleError div... > > > >> > I have find and modify that, but i don't know how to precise the ID > > > >> > and not the form type (:input) > > > > >> > errorPlacement: function(error, element) { > > > >> > if ( element.is(":input")) > > > >> > error.appendTo( "#TitleError" ); > > > >> > else if ( element.is(":checkbox") ) > > > >> > error.appendTo > > > >> > ( element.next() ); > > > >> > else > > > > >> > error.appendTo( element.parent().next() ); > > > >> > } > > > > >> > With that all my errors are going to the div#TitleError of course.... > > > >> > because i have only input elements in my form. > > > > >> > Thanks for wasting time with me. > > > > >> > On 20 août, 14:49, "Jörn Zaefferer" <[EMAIL PROTECTED]> > > > >> > wrote: > > > >> >> Nope, that isn't supported. Though its easy enough to implement that > > > >> >> based on errorPlacement. > > > > >> >> Jörn > > > > >> >> 2008/8/20 PanPan <[EMAIL PROTECTED]>: > > > > >> >> > Thx for your response but i already watch the doc. Can we specify > > > >> >> > location without function ? ex: > > > > >> >> > $(document).ready(function(){ > > > >> >> > $("#News").validate({ > > > >> >> > rules: { > > > >> >> > TitleNews: {required: true,minLength: 10}, > > > >> >> > IntroNews: {required: false,minLength: 150}, > > > >> >> > ContentNews: {required: true,minLength: 200}, > > > >> >> > TagsNews: {required: false,minLength: 5} > > > >> >> > }, > > > > >> >> > messages: { > > > >> >> > TitleNews: {required: "<img > > > >> >> > src=\"style/imgs/action_stop.gif\" > > > >> >> > alt=\"\" />Merci de rentrer un titre<img src=\"style/imgs/ > > > >> >> > action_stop.gif\" alt=\"\" />", > > > >> >> > minlength: "Votre titre doit contenir au > > > >> >> > moins > > > >> >> > 10 caractères !"}, > > > >> >> > IntroNews: {minlength: "L'intro doit contenir au moins 150 > > > >> >> > caractères !"}, > > > >> >> > ContentNews: { required: "Merci de rentrer le contenu de > > > >> >> > votre > > > >> >> > news !", > > > >> >> > minlength: "Le contenu de votre news > > > >> >> > doit être au moins de 200 caractères !"}, > > > >> >> > TagsNews: {minlength: "Le contenu des tags doit être d'au > > > >> >> > moins > > > >> >> > 5 caractères !"} > > > >> >> > }, > > > > >> >> > errorPlacement : { > > > >> >> > IntroNews : #TitleError, > > > >> >> > IntroNews : #IntroError, > > > >> >> > ContentNews : #ContentError, > > > >> >> > TagsNews : TagsError} > > > >> >> > }); > > > >> >> > }); > > > > >> >> > Thanks ! > > > > >> >> > On 20 août, 12:49, "Jörn Zaefferer" <[EMAIL PROTECTED]> > > > >> >> > wrote: > > > >> >> >> Documentation for the various options, including errorPlacement, > > > >> >> >> are > > > >> >> >> herehttp://docs.jquery.com/Plugins/Validation/validate#toptions > > > > >> >> >> There are also various demos available, eg. the Remember The Milk > > > >> >> >> Registration form, which uses > > > >> >> >> errorPlacement:http://docs.jquery.com/Plugins/Validation#Demos > > > > >> >> >> Jörn > > > > >> >> >> 2008/8/19 PanPan <[EMAIL PROTECTED]>: > > > > >> >> >> > Hi everyone, i'm having trouble with the jQuery Validate > > > >> >> >> > plugin. I > > > >> >> >> > easily find how to validate my form, but i would like to > > > >> >> >> > specify > > > >> >> >> > location for every error message the validate plug-in send. > > > >> >> >> > But i > > > >> >> >> > don't find, i think it's withe the option "errorPlacement" but > > > >> >> >> > i don't > > > >> >> >> > know how to use it exactly. > > > > >> >> >> > Here is my code : > > > > >> >> >> > $(document).ready(function(){ > > > >> >> >> > $("#News").validate({ > > > >> >> >> > rules: > > > >> >> >> > { > > > >> >> >> > TitleNews: > > > >> >> >> > {required: true,minLength: > > > >> >> >> > 10}, > > > >> >> >> > IntroNews: > > > >> >> >> > {required: false,minLength: > > > >> >> >> > 150}, > > > >> >> >> > ContentNews: {required: > > > >> >> >> > true,minLength: 200}, > > > >> >> >> > TagsNews: > > > >> >> >> > {required: false,minLength: 5} > > > >> >> >> > }, > > > >> >> >> > messages: > > > >> >> >> > { > > > >> >> >> > TitleNews: > > > >> >> >> > { required: "<img > > > >> >> >> > src=\"style/imgs/ > > > >> >> >> > action_stop.gif\" alt=\"\" />Merci de rentrer un titre<img > > > >> >> >> > src=\"style/ > > > >> >> >> > imgs/action_stop.gif\" alt=\"\" />", > > > >> >> >> > > > > >> >> >> > minlength: "Votre titre doit contenir au > > > >> >> >> > moins 10 caractères !" > > > >> >> >> > }, > > > >> >> >> > IntroNews: > > > >> >> >> > {minlength: "L'intro doit > > > >> >> >> > contenir au moins 150 caractères !"}, > > > >> >> >> > ContentNews: > > > >> >> >> > { > > ... > > plus de détails »