Hello Thiago. This is solution to my problem: @InjectComponent private TextField prodajaKolicinaPolje; @Inject private FieldValidatorSource fieldValidatorSource;
public FieldValidator<?> getAmountValidator() { return fieldValidatorSource.createValidators(prodajaKolicinaPolje, "required,max="+getBroj()); } and in my tml code: <t:textfield class="form-control" validate="prop:amountValidator" t:value="tiketProdajaKolicina" t:id="prodajaKolicinaPolje"> However I can see that JS is disabled, I don't get any warning like I would get in validation message nor I get value presented in my dialog box which pulls value from my fields. However if I press confirm it submits just fine. I think what causes this is because I input value into my t:textfield -> <t:textfield value="tiketProdajaKolicine"> Is there any solution to this? > To: users@tapestry.apache.org > Subject: Re: Putting property values in Validate > Date: Fri, 24 Oct 2014 13:27:28 -0200 > From: thiag...@gmail.com > > On Fri, 24 Oct 2014 12:54:32 -0200, Name Surname > <wintertime0...@outlook.com> wrote: > > > Hello, yes it's true I may not be very good with proper words to explain > > my situation but let me try it once again. > > > > What I need is following: I have a method that returns some value, now I > > want that value to be put into validate, something like: > > validate="max=${broj}" which returns value max based on return value > > from getBroj function. I hope it is more clear to you now. > > No, it's not clearer at all now. This is still 100% different from the > StackOverflow question and 100% equal to the original question here in the > mailing list. The question above was answered by the example using > FieldValidatorSource and I've posted an example for you. The JS validation > code, which you don't need to write yourself, will get the value from the > broj property automatically. > > Here's your solution: > > <t:textfield t:id="someField" t:validate="prop:dynamicConstraints"/> > > @Inject > private FieldValidatorSource source; > > @InjectComponent > private Field someField; > > public FieldValidator getDynamicConstraints() { > return source.createValidators(someField, "max", getBroj()); // > notice the call to getBroj() here. > } > > By the way, I've posted an answer to your other question in StackOverflow > (how to invoke an event handler method from JavaScript). It's the only > Tapestry-specific answer so far, as you didn't tell it was about Tapestry > in the SO question. You managed to describe poorly your question in SO > too. You should pay more attention to that if you want strangers to help > you for free. > > As Goerge said, you don't seem to not know at all what's client-side and > server-side. Please study this subject. It'll help you a lot. > > -- > Thiago H. de Paula Figueiredo > Tapestry, Java and Hibernate consultant and developer > http://machina.com.br > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org >