Re: ValidationDelete Error Message Display and locale (!) translation

2007-08-30 Thread ipoese


ipoese wrote:
 
 
 Erik Vullings-2 wrote:
 
 Does this link help:
 http://wiki.apache.org/tapestry/Tapestry5HowToOverrideTheDefaultErrorMessageBanner
 
 
 in general, yes, that would help to customize the error message quite
 nicely - however, i am using tapestry 4.1 and not 5. Does 4.1 support that
 feature aswell ?
 Anyway, i am going to try that in the next few days... 
 
 Thanks for the answer, and lets hope this works
 
 

i've tried this with Tapestry 4.1, but somehow i am not getting the Errors
translated. Furthermore, i am trying to translate Custom Validators - .i.e.
i have written a validator wich checks if a username is arealy in use. Upon
failure (the username already exists) i'm throwing the ValidationException
with 

throw new ValidatorException(NicknameAlreadyExists,null);

now, if i place the ValidationMessage_de.properties in the given source
Package (like Eric kindly suggested) i am still getting
NicknameAlreadyExists instead of the translated String which was defined in
the ValidationMessage_de.properties. 
i've already said that i am using tapestry 4.1 and not 5... is there any
other way anybody could possibly think of short of hardcoding the
errormessages in the Validator ?

many thanks in adavance, and sorry my reply took so long...

-- 
View this message in context: 
http://www.nabble.com/ValidationDelete-Error-Message-Display-and-locale-%28%21%29-translation-tf4287771.html#a12411558
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



ValidationDelete Error Message Display and locale (!) translation

2007-08-17 Thread ipoese

Hi Folks, 

for all those who cannot make much sense of my subject - sorry. I didn't
know any better way of putting it, really. 
So, after i got validation working and figured out how to use the
DelegationValidatior to display the Errors next to my input fields - here's
the next... challenge :)

Down to Business:
i need those errors translated into the current locale i am using (currently
i have two, but i need to be able to support more). I know how to do it
using the message prefix on components and the key span in html, but how do
i translate the acctual message thrown by the validator class ? do i have to
do it manually ? if so, where can i go fetch the keys and corresponding
translations for my current locale since i am really not up for specifying
the translations in a Java class - that would be mighty ugly - or so i
think...

so, if any of you guys ran into that one before, i would really appreciate a
some help.
Thanks a lot in advanche
-- 
View this message in context: 
http://www.nabble.com/ValidationDelete-Error-Message-Display-and-locale-%28%21%29-translation-tf4287771.html#a12206074
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



[Tapestry Beginner] Validation is ignored

2007-08-16 Thread ipoese

Hi Everyone, 

i've been teaching myself tapestry for some time now, and everytime i think
i am finally getting a grip on it something new comes up. 
OK, here's the deal... (i'll be using snippets since you guys probably don't
want a million lines of code... all code i post compiles in it's context and
runs without exceptions)

i have to pages, Login and Register

First for login:

Login.html has:
tr
  tdlabel jwcid=@FieldLabel field=component:usernameUser
Name/label/td
  tdinput jwcid=username//td
/tr

Login.page has:
  bean name=ValidString class=myproject.Validator.ValidString /
  
  component id=username type=TextField
binding name=value value=username/
binding name=validators value=validators:required,$ValidString /
binding name=displayName value=message:username /
  /component

Login.java has:

  public abstract String getUsername();
  public abstract void setUsername(String Username);

  public IPage tryLogin(){ // -- gets called when the form around username
is submitted
//do fancy stuff
  }

this works quite good. it checks the enteresd string in username against the
self written Validator $ValidString. I can debug, breakpoint, step-though
and see all the magic happening. quite cool, acctually.

Now for Register

Register.html
  trtdfirstname /tdtdinput type=text jwcid=firstname
//td/tr
  trtdlastname  /tdtdinput type=text jwcid=lastname
//td/tr

Register.page
  bean name=ValidString class=myproject.Validator.ValidString / !--
same validator as before --

  !-- Form --
  component id=register type=Form
binding name=listener value=listener:tryUserCreate/
  /component
  
  component id=submitRegister type=Submit
  /component
  
  !-- Attributes of a Person --
  component id=firstname type=TextField
binding name=value value=firstname/
binding name=validators value=validators:required,$ehfgbiasdbgujas
/ !-- NOTE THIS --
  /component
  
  component id=lastname type=TextField
binding name=value value=lastname/
binding name=validators value=validators:required,$ValidString /
  /component

Register.java

  public abstract String getFirstname();  
  public abstract String getLastname();

  public IPage tryUserCreate(){
// do more fancy stuff
  }

now this acctually compiles and runs (!!!) without an error or expection
even tho the gibberish Validator bean in firstname does not exist. This form
has a lot more fields to it, and two more self written validators but this
is pretty much the essence. 
now - the Validators here get ignored. i can write anything after the $ and
it still runs through without any trouble. I can even delete the bean
statement completely withouth raising an exception. 
required is also ignored - it jumps right into the listener without looking
at the Validators. 
This started happening after i had to refactor the class to move it to
another package. Used the NetBeans refactor (which always worked before) and
suddenly it would not validate anymore. Refactoring it back does not help
either.

if i type somthing like this in one if the TextFields it does give me an
exception upon loading the page:
binding name=validators value=validators:required,fsgdsfghkjsn /

Here is what i have tried:

i have moved the Form around in register - even used it inline - same thing
i have copied and pasted the content to a new file - same thing
i have used tapestry 4.1.1, 4.1.2 and the nightly 4.1.3 - same thing
i have deleted the project and reloaded it from svn - same thing
i have set up NetBeans completely new - same thing
i have run the application on two more machines (Windows, Debian, Ubuntu) -
same thing
i have run it with sun java 1.5 and 1.6 - same thing

also, if i tried to use a Fieldlabel (maybe thats the error ?) and copied
the username from Login to Register (it has a username too) - one to one
copy - works in Login, not in Register (the Fieldlabel says no DisplayName
was set in Username - which i definetly had set - and throws an expception)

anybody got any idea why the validators get ignored or why Register is
behaving to strange ? i really need this to work sometime soon... 

Hope this mail is not too cryptic,
Ingmar
-- 
View this message in context: 
http://www.nabble.com/-Tapestry-Beginner--Validation-is-ignored-tf4278261.html#a12177442
Sent from the Tapestry - User mailing list archive at Nabble.com.


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



Re: [Tapestry Beginner] Validation is ignored

2007-08-16 Thread ipoese


Marcus Schulte wrote:
 
 I can't really see your mistake from the code, but anyway, here are
 two things that could be wrong:
 
 1. for client-side validation to work, you need to set the
 clienValidationEnabled parameter of your form to true
 
 2. be sure to bind the form's delegate-parameter to your delegate.
 
 3. if you want server-side validation check the delegate bean using
 hasErrors
 
 

thanks for the answer - i have figured it out by myself by now - i used the
listener event in the form instead of success - which means no matter what
validation says, the form will still be submitted to the listener. This is
not what i would have expected to happen - but it did happen, and it
confused me greatly. Using the SubmitType submit and success listener now
gets it all working nicely even with the self written validators.

again, thanks for the answer - i think the issue at hand is resolved... 

-- 
View this message in context: 
http://www.nabble.com/-Tapestry-Beginner--Validation-is-ignored-tf4278261.html#a12189234
Sent from the Tapestry - User mailing list archive at Nabble.com.


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