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