[T5] Annotations are too static

2007-10-04 Thread Julien HENRY
Hi,

I really like the way you can configure beaneditform
and grid with annotations in T5 (Validation, Column
ordering, ...). Therefore, for the kind of projects I
have to deal with, I think it will be too static.

Exemple:

I have a page with a big form allowing user to
create/update a card. The form has 2 submit buttons.
One for creating/updating the card as draft (only card
name input field is required), and one for validating
the card. The validation create/update the card with
many additional input fields required.

How can I handle such a case with T5? If I put
@Required on a field, can I change this at runtime
depending on the context? Ever better: can I mark some
fields as required depending on the submit button that
was pushed?

Another common issue: how can I declare a field as
required when another contains a specific value (say
when a checkbox is checked)...

Thanks

Julien


  
_ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [T5] Annotations are too static

2007-10-04 Thread Robin Helgelin
On 10/4/07, Julien HENRY [EMAIL PROTECTED] wrote:
 I have a page with a big form allowing user to
 create/update a card. The form has 2 submit buttons.
 One for creating/updating the card as draft (only card
 name input field is required), and one for validating
 the card. The validation create/update the card with
 many additional input fields required.

 How can I handle such a case with T5? If I put
 @Required on a field, can I change this at runtime
 depending on the context? Ever better: can I mark some
 fields as required depending on the submit button that
 was pushed?

 Another common issue: how can I declare a field as
 required when another contains a specific value (say
 when a checkbox is checked)...

You can always do your own checking/validation. Tapestry calls the
event validate, i.e. after the regular @Validate have been validated,
it calls the event validate to see if there are more problems found.

public String onValidate() {
  // my own checks

  if (form.getHasErrors()) {
return null; // return same page
  } else {
return success; // return page success
  }
}

-- 
regards,
Robin

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE : Re: [T5] Annotations are too static

2007-10-04 Thread Julien HENRY
It's not really client-side validation. Is the
onValidate called by an AJAX request?

IMHO checking if a field is filled when a checkbox is
checked should not require a full page refresh.

--- Robin Helgelin [EMAIL PROTECTED] a écrit :

 On 10/4/07, Julien HENRY [EMAIL PROTECTED] wrote:
  I have a page with a big form allowing user to
  create/update a card. The form has 2 submit
 buttons.
  One for creating/updating the card as draft (only
 card
  name input field is required), and one for
 validating
  the card. The validation create/update the card
 with
  many additional input fields required.
 
  How can I handle such a case with T5? If I put
  @Required on a field, can I change this at runtime
  depending on the context? Ever better: can I mark
 some
  fields as required depending on the submit button
 that
  was pushed?
 
  Another common issue: how can I declare a field as
  required when another contains a specific value
 (say
  when a checkbox is checked)...
 
 You can always do your own checking/validation.
 Tapestry calls the
 event validate, i.e. after the regular @Validate
 have been validated,
 it calls the event validate to see if there are more
 problems found.
 
 public String onValidate() {
   // my own checks
 
   if (form.getHasErrors()) {
 return null; // return same page
   } else {
 return success; // return page success
   }
 }
 
 -- 
 regards,
 Robin
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 



  
_ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]