George,

I have done something similar to this.  I haven't looked at browser
compatability yet(we're currently using this with ie6), but the concept
that I use is that I look at the parents of the form field, trying to find
out if the element is hidden.  If I find that a parent that is hidden, then
I take appropriate action.

My javascript loop looks like this:

var hiddenParent = false;
for(parent=formField.parentElement; parent != null && hiddenParent ==
false; parent = parent.parentElement) {
     if(parent.currentStyle.display == none) {
          hiddenParent = true;
     }
}

if(hiddenParent) {
     etc, etc
}

Hope this helps a little.  If there are better ways to do this, I'd love to
get the feedback :-)
Nick



                                                                                       
                                                
                      George Steimer                                                   
                                                
                      <[EMAIL PROTECTED]        To:       [EMAIL PROTECTED]            
                                    
                      m>                       cc:                                     
                                                
                                               Subject:  Complex Form Validation       
                                                
                      11/18/2003 02:18                                                 
                                                
                      PM                                                               
                                                
                      Please respond to                                                
                                                
                      "Struts Users                                                    
                                                
                      Mailing List"                                                    
                                                
                                                                                       
                                                
                                                                                       
                                                




We are trying to perform some complex form validaion with the new Validator
plugin.  Here is what we are trying to do:

1 -- validate a form field based on other form fields
2 -- validate a form field based on div style settings

I know that I could solve the first problem with the old validation
architecture, but is there a way to do that through the validator.xml?  I'm
not sure about the second problem.  The code looks something like this

<div id="myDiv" style="display: none">
    //my form element here
</div>

So is it possible to only validate the form element above only if the
enclosing div display is block?  I've looked, but couldn't find anything
explaining how to go about this.  Any ideas?

Thanks in advance,

George

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






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

Reply via email to