You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Twan Kogels <tw...@twansoft.com> on 2004/10/12 21:03:09 UTC

Query depends part of validation.xml ?

Hello people,

I'm wondering if there is a way to query the value's in validation.xml. I'm 
particulary interested in the "depends" part which contains the "required" 
statement.

This one indicates if a form field is required. When i know this one then i 
can program a general routine which prints a little red star with the 
required form field in my html.

But the problem is i don't know how i can query the "depends" part in the 
validation.xml. Does anybody know where i must start, for example which 
classes should i extend or override?

I'm currently using Velocity for my View layer.

Can anyone offer me a helping hand?

Cheers,
Twan Kogels



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Query depends part of validation.xml ?

Posted by Twan Kogels <tw...@twansoft.com>.
Hello again ;-)

I've dived into the struts source code and struggled for a couple of hours 
(was already struggling a bit before i wrote the email at the bottom).

Then i discovered the Resource class which seems to be the answer to my 
question. Here's some pseudo code:
(warning this is only theorical)

============
Getting the depends part in the validation.xml. This will print every 
element in the depends part.

ValidatorResources vr=Resources.getValidatorResources(); //validator 
already parsed xml stuff
Forum f=vr.getForm(loc, "myform");
Field f=f.getField("myfield");
List list=f.getDependencyList();
while(item in list){
print(item);
}
============

What do you all think am i on the right approach or am i just totally wrong?

Cheers,
Twan Kogels


At 21:03 12-10-2004, you wrote:
>Hello people,
>
>I'm wondering if there is a way to query the value's in validation.xml. 
>I'm particulary interested in the "depends" part which contains the 
>"required" statement.
>
>This one indicates if a form field is required. When i know this one then 
>i can program a general routine which prints a little red star with the 
>required form field in my html.
>
>But the problem is i don't know how i can query the "depends" part in the 
>validation.xml. Does anybody know where i must start, for example which 
>classes should i extend or override?
>
>I'm currently using Velocity for my View layer.
>
>Can anyone offer me a helping hand?
>
>Cheers,
>Twan Kogels
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org