[jQuery] Re: Best of both jquery validate and jqueryyav

2007-08-31 Thread SeViR


Jörn Zaefferer escribió:


Olivier Percebois-Garve schrieb:

Will implies be integrated anytime soon in validate ?


Could someone please explain how implies works like? I looked at the 
examples of YAV, but apart from the notion of dependencies I could 
figure out how it works. I'd be happy to integrate a similar feature 
into the validation plugin, once I understand what it does. Maybe its 
already possible and just not documented.


-- Jörn

This is a simple example of YAV implies 
http://yav.sourceforge.net/en/learnbyexample.html

but more complexes rules can be set with YAV (or jQuery.YAV) by example:

A: checkbox
B: textbox
C: selectbox

The rule:
(A=checked AND B='myself') IMPLIES (C='Freelance')

But you can set this before rule in another rule:
D: the before rule
E: textbox

The 2nd rule:
D is passed IMPLIES E='I work alone'

That I see, Validation plugin only can do this requirements using custom 
functions.


--
Best Regards,
José Francisco Rives Lirola sevir1ATgmail.com

SeViR CW · Computer Design
http://www.sevir.org
 
Murcia - Spain




[jQuery] Re: Best of both jquery validate and jqueryyav

2007-08-31 Thread SeViR


Olivier Percebois-Garve escribió:

Hi

So far I have been able to make custom error boxes with the following 
code:

  $(.error).each(function(i, n){
$formElement = $(n).next('input, 
select');

$offset = $formElement.offset();
$left = 
$offset.left+$formElement.width()+$formElement.parent().next(.error_exclamation_mark).width();

$top = $offset.top;
$(n).wrap(div class=\errorBox 
clearfix\/div);
$(n).before('div 
class=\errorBoxTitle\Error/div');   
$formElement.after('div 
class=\error_exclamation_mark\/div');  
$formElement.wrap('div 
class=\errorFormElement/div');   
  

$(n).parent(.errorBox).css('position', 'absolute').css('left', 
$left).css('top', $top);

  });

Open issues with that are :
- the code is being runned each time I hit the submit button, so the 
error boxes are are duplicated.

 I dont know how to make it run just once.
-my dimension code get some positions wrong, I cant tell where it 
comes from.


jQuery.YAV remove automatically before the next validation the old error 
tags, but you wrap the errors
inside an another DIV (errorBox) so this is not removed. Analizing your 
code, I think that you are trying

something like this example, maybe?:

The rules sets:
NAME: required
HOTMAIL: implies pre-condition if checked then HOTMAIL ACCOUNT must pass 
the regexp expression.


I don't need move the error messages into absolute position. The 
messages are removed in each validation
without duplication problems, I can set the exclamation mark and the 
errorBoxTittle and the more important,
I don't need wrap any input element into to another DIV for to change 
the CSS of the field on error.


http://projects.sevir.org/storage/yav/moreimpliesexample.html

The JS code:
   $(document).ready(function(){
   $(#myform).yav({
   errorPositon: before,
   errorTag: div,
   errorClass: errorBox,
   onError: function(){
   $(.errorBox).each(function(){
   $(this).html(
   'div class=errorTitleERROR/div' +
   'div class=errorContent'+$(this).html()+'/div'
   );
   });
   return false;
   }
   },{
   inputclasserror: errorFormElement
   });
   });



But that is peanuts compared to the pain of getting the implies 
rules to work.

I just broke my head on that the whole afternoon and feel very frustrated.

The rules syntax seem easier on the yav website.

Sevir, you may want to add examples on your website.
If I can give some constructive critics:
-The code in the alt attribute may be indented. its just too long to 
read.
-Each example should have only one specific thing: for instance 
http://projects.sevir.org/storage/yav/relationships.html

 that page demonstrates a relation + a custom rule.



Ok, I will see that, thanks for your suggestions.

Ok, that's what I can say for now, my brain is smoking ;-(

-Olivier



--
Best Regards,
José Francisco Rives Lirola sevir1ATgmail.com

SeViR CW · Computer Design
http://www.sevir.org
 
Murcia - Spain




[jQuery] Re: Best of both jquery validate and jqueryyav

2007-08-30 Thread Olivier Percebois-Garve
Thanks.
I only saw the second example. I'll play with it and be back with my results
soon.
(may I suggest you to add the examples to the downloads )

-Olivier

On 8/30/07, SeViR [EMAIL PROTECTED] wrote:


 I don't understand WHY you need pass a function for show the errors...
 The position of the
 errors in jQuery.YAV is related to the error element. So you can only
 pass jQuery transversing
 and manipulation functions (after, before, prepend,). The rest
 (the error visualization) can
 be set using CSS. You can also play with error elements after the
 validation process using onError
 function.

 As I see, your code seems show the error in a layer box. This example
 with jQuery.YAV can help
 you (the first example):

 The code:

 http://letmehaveblog.blogspot.com/2007/08/some-ideas-using-jqueryyav-plugin.html
 Run the example (clicking in the Go! button):
 http://projects.sevir.org/storage/yav/idea1.html

 Maybe you have the idea using validation plugin and you don't see that
 you can do similar things using
 other methods ;-)

 Jose

 Olivier Percebois-Garve escribió:
  Hi
 
  I have a dilema between jquery validate and jqueryyav.
 
  I am using validate which offers great flexibility in the error
  placement, because I can pass a function to it :
 
  errorPlacement: function(error, element){ 
 
  jqueryYAV offers the implies that I need, but I cannot pass a
  function to the error placement.
  Its showError method looks like that :
 
  evalText = jQuery('#+ objError.id +'). +
  params.errorPosition +
(\ +
 + params.errorTag +  class='+params.errorClass+' +
 objError.msg + / + params.errorTag + 
 
+ \);
 
  Is there a miracle solution ? ;-)
  Will implies be integrated anytime soon in validate ?
  Is jqueryYAV's code easily hackable in order to pass a function to the
  errorPosition ?
 
  -Olivier
 
 
 
  PS: here is my actual errorPlacement code just to let know the sort of
  thing I'm doing :
 
  errorPlacement: function(error, element){
element.after(div class=\error_exclamation_mark\/divdiv
  class=\errorBox clearfix\div
  class=\errorBoxTitle\Error/div/div);
$left =
  element.offset
 ().left+element.width()+element.next(.error_exclamation_mark).width();
$top = element.offset().top;
element.siblings(div.errorBox).css('position',
  'absolute').css('left', $left).css('top', $top);
error.appendTo(element.siblings(div.errorBox));
if ($.browser.msie) element.wrap(div
  id=\wrap_select_for_ie\/div);
  }
 
 


 --
 Best Regards,
 José Francisco Rives Lirola sevir1ATgmail.com

 SeViR CW · Computer Design
 http://www.sevir.org

 Murcia - Spain




[jQuery] Re: Best of both jquery validate and jqueryyav

2007-08-30 Thread Olivier Percebois-Garve
Hi

So far I have been able to make custom error boxes with the following code:
  $(.error).each(function(i, n){
$formElement = $(n).next('input, select');
$offset = $formElement.offset();
$left =
$offset.left+$formElement.width()+$formElement.parent().next(.error_exclamation_mark).width();
$top = $offset.top;
$(n).wrap(div class=\errorBox
clearfix\/div);
$(n).before('div
class=\errorBoxTitle\Error/div');
$formElement.after('div
class=\error_exclamation_mark\/div');
$formElement.wrap('div
class=\errorFormElement/div');

$(n).parent(.errorBox).css('position',
'absolute').css('left', $left).css('top', $top);
  });

Open issues with that are :
- the code is being runned each time I hit the submit button, so the error
boxes are are duplicated.
 I dont know how to make it run just once.
-my dimension code get some positions wrong, I cant tell where it comes
from.

But that is peanuts compared to the pain of getting the implies rules to
work.
I just broke my head on that the whole afternoon and feel very frustrated.

The rules syntax seem easier on the yav website.

Sevir, you may want to add examples on your website.
If I can give some constructive critics:
-The code in the alt attribute may be indented. its just too long to read.
-Each example should have only one specific thing: for instance
http://projects.sevir.org/storage/yav/relationships.html
 that page demonstrates a relation + a custom rule.


Ok, that's what I can say for now, my brain is smoking ;-(

-Olivier


On 8/30/07, SeViR [EMAIL PROTECTED] wrote:


 I don't understand WHY you need pass a function for show the errors...
 The position of the
 errors in jQuery.YAV is related to the error element. So you can only
 pass jQuery transversing
 and manipulation functions (after, before, prepend,). The rest
 (the error visualization) can
 be set using CSS. You can also play with error elements after the
 validation process using onError
 function.

 As I see, your code seems show the error in a layer box. This example
 with jQuery.YAV can help
 you (the first example):

 The code:

 http://letmehaveblog.blogspot.com/2007/08/some-ideas-using-jqueryyav-plugin.html
 Run the example (clicking in the Go! button):
 http://projects.sevir.org/storage/yav/idea1.html

 Maybe you have the idea using validation plugin and you don't see that
 you can do similar things using
 other methods ;-)

 Jose

 Olivier Percebois-Garve escribió:
  Hi
 
  I have a dilema between jquery validate and jqueryyav.
 
  I am using validate which offers great flexibility in the error
  placement, because I can pass a function to it :
 
  errorPlacement: function(error, element){ 
 
  jqueryYAV offers the implies that I need, but I cannot pass a
  function to the error placement.
  Its showError method looks like that :
 
  evalText = jQuery('#+ objError.id +'). +
  params.errorPosition +
(\ +
 + params.errorTag +  class='+params.errorClass+' +
 objError.msg + / + params.errorTag + 
 
+ \);
 
  Is there a miracle solution ? ;-)
  Will implies be integrated anytime soon in validate ?
  Is jqueryYAV's code easily hackable in order to pass a function to the
  errorPosition ?
 
  -Olivier
 
 
 
  PS: here is my actual errorPlacement code just to let know the sort of
  thing I'm doing :
 
  errorPlacement: function(error, element){
element.after(div class=\error_exclamation_mark\/divdiv
  class=\errorBox clearfix\div
  class=\errorBoxTitle\Error/div/div);
$left =
  element.offset
 ().left+element.width()+element.next(.error_exclamation_mark).width();
$top = element.offset().top;
element.siblings(div.errorBox).css('position',
  'absolute').css('left', $left).css('top', $top);
error.appendTo(element.siblings(div.errorBox));
if ($.browser.msie) element.wrap(div
  id=\wrap_select_for_ie\/div);
  }
 
 


 --
 Best Regards,
 José Francisco Rives Lirola sevir1ATgmail.com

 SeViR CW · Computer Design
 http://www.sevir.org

 Murcia - Spain




[jQuery] Re: Best of both jquery validate and jqueryyav

2007-08-30 Thread Jörn Zaefferer


Olivier Percebois-Garve schrieb:

Will implies be integrated anytime soon in validate ?


Could someone please explain how implies works like? I looked at the 
examples of YAV, but apart from the notion of dependencies I could 
figure out how it works. I'd be happy to integrate a similar feature 
into the validation plugin, once I understand what it does. Maybe its 
already possible and just not documented.


-- Jörn