Re: [jQuery] Validation Plugin:need help with errorPlacement

2009-12-15 Thread Gian-ava


Leonardo, today you're my man!
It finally worked!

THAT was what I was looking for.

I can't tell you how long I've been trying to achieve just that result, so
you can't imagine how much I appreciate your help. Really, thanks!

I actaully had found a workaround to place the error mesage with just CSS,
but this is the solution I was looking for.

Again, thanks man! Cheers to you.
;-)

(In caso sei italiano, visto che ti chiami Leonardo, grazie mille!).


Leonardo K wrote:
 
 Every input element is wrapped in a div with class 'rowElem'?
 
 So your errorPlacement should be something like this:
 
 errorPlacement: function(error, element) {
  $(element).closest('.rowElem').after(error); //the method closest
 get the closest parent with class rowElem
 },
 
 On Mon, Dec 14, 2009 at 20:06, Gian-ava b...@stylozero.com wrote:
 

 Leonardo,

 I see. Firebug' error console says:

 Error: missing ) after argument list
 Line: 8, Column: 12
 Source Code:
}

 Strange, since I don't think this  is correct.

 Also, it says:
 Error: syntax error
 Line: 7, Column: 30
 Source Code:
  errorPlacement: function(error, element) {

 Again, I don't see any error there.

 Anyway, if I write this, the error label gets printed after the .roxElem,
 but for each required field I get as many error labels as I defined (ex:
 I
 got 4 required fields, so for rowElem I get the 4 messages):

 $$(document).ready(function(){
$('#actionform').validate({

errorPlacement: function(error, element) {
error.insertAfter(.rowElem);
 },

submitHandler: function(form) {

$(form).ajaxSubmit({

success: function() {
$('#actionform').hide();
$('#content').append(p class='thanks'Thanks!
 Your
 request has been sent./p)
}
   });
 }

});
 });

 I can't believe it is so difficult to control where to display the error
 message. The problem is that since I use jqtransform plugin, the latter
 prints and wraps all fields into a lot of stuff fot styling elements, and
 when the validation plugin prints the error label after the input field,
 it
 actually display IN the field. I want it out of the field, so I need it
 to
 be printed after the .rowElem.

 Where's the plugin author?
 --
 View this message in context:
 http://old.nabble.com/Validation-Plugin%3Aneed-help-with-errorPlacement-tp26719238s27240p26780208.html
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com.


 
 

-- 
View this message in context: 
http://old.nabble.com/Validation-Plugin%3Aneed-help-with-errorPlacement-tp26719238s27240p26795821.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



Re: [jQuery] Validation Plugin:need help with errorPlacement

2009-12-15 Thread Gian-ava


Oh, for posterity, in case anybody else find this useful, here is the
complete code that worked fine for me.

$(document).ready(function(){
$('#actionform').validate({

errorPlacement: function(error, element) {
$(element).closest('.rowElem').after(error);
},

submitHandler: function(form) {
 
$(form).ajaxSubmit({
   
success: function() {
$('#actionform').hide();
$('#content').append(p class='thanks'Thanks! Your
request has been sent./p)
}
   });
 }
 
});
});
-- 
View this message in context: 
http://old.nabble.com/Validation-Plugin%3Aneed-help-with-errorPlacement-tp26719238s27240p26795822.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



Re: [jQuery] Validation Plugin:need help with errorPlacement

2009-12-14 Thread Gian-ava

Leonardo, thanks for your interest in my case.

I've tried out the code with the debug option. I just don't know what the
debug function will generate and where I need to look to see the result.

Otherwise, again, your code doesn't get validation to work.

This one do work:

$(document).ready(function(){
$('#actionform').validate({
 
 submitHandler: function(form) {
 
   $(form).ajaxSubmit({
success: function() {
$('#actionform').hide();
$('#content').append(p class='thanks'Thanks! Your
request has been sent./p)
}
   });
 }
 
});
});


And, as I mention in my first entry, when I tried to use the
error.insertAfter function, I got what I wanted, only I got for each field
the error messages of all other fields as well. Probably something to do
with the place where I put the function in the code.


Leonardo K wrote:
 
 Try to use the debug:true option to find what's going on. Check if the
 form
 has the id=actionform.
 
 $('#actionform').validate({
 debug:true,
 submitHandler: function(form) {
 $(form).ajaxSubmit({
 success: function() {
 $('#actionform').hide();
 $('#content').append(p class='thanks'Thanks! Your
 request
 has been sent./p
 }
 });
 },
 errorPlacement: function(error, element) {
 error.insertAfter(.rowElem);
 }
 });
 
 On Sun, Dec 13, 2009 at 20:52, Gian-ava b...@stylozero.com wrote:
 

 Hi Leonardo,

 Thanks for answering.

 Unfortunately, the validation doesn't work at all with the code you
 provided: the form is sent even if the required fields are empty.

 Any hint?


 Leonardo K wrote:
 
  This should work:
 
  $(document).ready(function(){
 $('#actionform').validate({
  submitHandler: function(form) {
 $(form).ajaxSubmit({
 success: function() {
 $('#actionform').hide();
$('#content').append(p class='thanks'Thanks!
 Your
  request has been sent./p
  }
});
  },
  errorPlacement: function(error, element) {
  error.insertAfter(.rowElem);
  }
 });
  });
 
  On Sun, Dec 13, 2009 at 18:09, Gian-ava b...@stylozero.com wrote:
 
 
  Oh c'mon, nobody who can helo me out with this?
 
  Nobody who can figure out how to code the right errorPlacement to
 place
  the
  error label where I need it?
  --
  View this message in context:
 
 http://old.nabble.com/Validation-Plugin%3Aneed-help-with-errorPlacement-tp26719238s27240p26769256.html
  Sent from the jQuery General Discussion mailing list archive at
  Nabble.com.
 
 
 
 

 --
 View this message in context:
 http://old.nabble.com/Validation-Plugin%3Aneed-help-with-errorPlacement-tp26719238s27240p26770633.html
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com.


 
 

-- 
View this message in context: 
http://old.nabble.com/Validation-Plugin%3Aneed-help-with-errorPlacement-tp26719238s27240p26778043.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



Re: [jQuery] Validation Plugin:need help with errorPlacement

2009-12-14 Thread Gian-ava

Leonardo,

I see. Firebug' error console says:

Error: missing ) after argument list
Line: 8, Column: 12
Source Code:
}

Strange, since I don't think this  is correct.

Also, it says:
Error: syntax error
Line: 7, Column: 30
Source Code:
  errorPlacement: function(error, element) { 

Again, I don't see any error there.

Anyway, if I write this, the error label gets printed after the .roxElem,
but for each required field I get as many error labels as I defined (ex: I
got 4 required fields, so for rowElem I get the 4 messages):

$$(document).ready(function(){
$('#actionform').validate({

errorPlacement: function(error, element) {
error.insertAfter(.rowElem);
},

submitHandler: function(form) {
 
$(form).ajaxSubmit({
   
success: function() {
$('#actionform').hide();
$('#content').append(p class='thanks'Thanks! Your
request has been sent./p)
}
   });
 }
 
});
});

I can't believe it is so difficult to control where to display the error
message. The problem is that since I use jqtransform plugin, the latter
prints and wraps all fields into a lot of stuff fot styling elements, and
when the validation plugin prints the error label after the input field, it
actually display IN the field. I want it out of the field, so I need it to
be printed after the .rowElem.

Where's the plugin author?
-- 
View this message in context: 
http://old.nabble.com/Validation-Plugin%3Aneed-help-with-errorPlacement-tp26719238s27240p26780208.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



Re: [jQuery] Validation Plugin:need help with errorPlacement

2009-12-13 Thread Gian-ava

Oh c'mon, nobody who can helo me out with this?

Nobody who can figure out how to code the right errorPlacement to place the
error label where I need it?
-- 
View this message in context: 
http://old.nabble.com/Validation-Plugin%3Aneed-help-with-errorPlacement-tp26719238s27240p26769256.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



Re: [jQuery] Validation Plugin:need help with errorPlacement

2009-12-13 Thread Gian-ava

Hi Leonardo,

Thanks for answering.

Unfortunately, the validation doesn't work at all with the code you
provided: the form is sent even if the required fields are empty.

Any hint?


Leonardo K wrote:
 
 This should work:
 
 $(document).ready(function(){
$('#actionform').validate({
 submitHandler: function(form) {
$(form).ajaxSubmit({
success: function() {
$('#actionform').hide();
   $('#content').append(p class='thanks'Thanks! Your
 request has been sent./p
 }
   });
 },
 errorPlacement: function(error, element) {
 error.insertAfter(.rowElem);
 }
});
 });
 
 On Sun, Dec 13, 2009 at 18:09, Gian-ava b...@stylozero.com wrote:
 

 Oh c'mon, nobody who can helo me out with this?

 Nobody who can figure out how to code the right errorPlacement to place
 the
 error label where I need it?
 --
 View this message in context:
 http://old.nabble.com/Validation-Plugin%3Aneed-help-with-errorPlacement-tp26719238s27240p26769256.html
 Sent from the jQuery General Discussion mailing list archive at
 Nabble.com.


 
 

-- 
View this message in context: 
http://old.nabble.com/Validation-Plugin%3Aneed-help-with-errorPlacement-tp26719238s27240p26770633.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Validation Plugin:need help with errorPlacement

2009-12-09 Thread Gian-ava

Hi,

I am using the Validation Plugin from Bassistance (by Jörn Zaefferer) and I
need to append the error message after the div class=rowElem not after
the input field.

This is the HTML I get:

div class=rowElem
label class=align for=country style=cursor: 
pointer;Country/label
div class=jqTransformInputWrapper
div class=jqTransformInputInner
div
input class=required jqtranformdone 
jqTransformInput error
type=text name=country/
label class=error for=country 
generated=trueThis field is
required./label
/div
/div
/div
em*/em
/div

This is the Javascript:

$(document).ready(function(){
$('#actionform').validate({
 
 submitHandler: function(form) {
 
   $(form).ajaxSubmit({
success: function() {
$('#actionform').hide();
$('#content').append(p class='thanks'Thanks! Your
request has been sent./p)
}
   });
 }
 
});
});

I am sure I need to use this:
errorPlacement: function(error, element) {
error.appendTo( element.parent().next() );
},

… but I can't figure out how to target the rowElem div.

I tried with:
error.insertAfter(.rowElem); 

…but I get all the error messages for each input.

Any help?

-- 
View this message in context: 
http://old.nabble.com/Validation-Plugin%3Aneed-help-with-errorPlacement-tp26719238s27240p26719238.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.