The answers you get to this is are going to be mostly personal
preference, so I'll give you mine.

I would definitely create at least one component to contain all three
of the types of identifiers, then when you add a fourth, or remove
one, they magically get updated on all the pages.

Whether you create a component per identifier is really going to
probably be more about how much plumbing you need to drive each of
them. For instance, the first two seem pretty straight forward. Maybe
for the third you want to create a component to wrap any complexity
around doing cross field validation.

Maybe something like:

<t:form>
<t:accountValidation account="userAccount"/>
</t:form>

// AccountValidation.tml
<t:container>
<t:delegate to="chosenMethodBlock"/>

<t:block t:id="policyNumber">...</t:block>
<t:block t:id="creditCardNumber">...</t:block>
<t:block t:id="backAccount">...</t:block>
</t:container>

// AccountValidation.java

@Parameter
private Account account;

@Inject
private Block policyNumber;
... etc

Block getChosenMethodBlock() {
    return determineBlockByAccount();
}


Josh

On Fri, Jan 13, 2012 at 6:46 AM, captain_rhino
<graeme.kitc...@axa-travel-insurance.com> wrote:
> Good afternoon.
>
> A few pointers on how to go about doing the following would be apprecaited
> from anyone please.
>
> I have a page where one and ONLY ONE of the following unique identifiers
> needs to appear on screen to a user, have values entered into those fields
> and have the values of the fields  validated, each having differnet
> validation rules.
>
> The three types of identifier are:-  (there maybe more in the future)
>
> 1. A Policy Number
>
> 2. A credit card Number
>
> 3. UK format Bank account details - this would be one field for the bank
> account number and followed by 3 separate text fields to represent the sort
> code (three 2-digit textfields)
>
> Do I create 3 separate components and include all in a page and somethings
> decides which one should be rendered on screen - again not sure how to
> approach this.  This is something that could be replicated on several pages
> throughout the application.
>
> Again I'm not looking for an exact solution just a few pointers to get me
> started on how to approach this in Tapestry particularly with regards to the
> creation of new components.  Thx in advance.
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Advice-on-creating-new-components-tp5142727p5142727.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to