cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Larsen" <gary.lar...@envisn.com>
Subject RE: CForms hide button on load
Date Fri, 20 Jan 2006 20:20:11 GMT
Excellent!  What I didn't get was on-value-changed is fired during
form_load.
 
Thank you for the help.
 
Gary



Here's how I've done that:

<fd:booleanfield id="useDefaultPort">
        <fd:label>Use default FTP Port (Leave checked if you are not
sure)</fd:label>
        <fd:initial-value>true</fd:initial-value> 
        <fd:on-value-changed>
            <javascript>
                <![CDATA[
                var parent = event.source.parent;
                var useDefaultPort =
parent.lookupWidget("useDefaultPort").getValue(); 
                                    
                if(useDefaultPort == "false") {
 
parent.lookupWidget("remotePort").setState(WidgetState.ACTIVE);
                } else { 
 
parent.lookupWidget("remotePort").setState(WidgetState.INVISIBLE);
                    parent.lookupWidget("remotePort").setValue(new
java.lang.Integer(21));
                } 
            ]]>
            </javascript>
        </fd:on-value-changed>
    </fd:booleanfield>
    <fd:field id="remotePort" required="true" state="invisible"> 
        <fd:datatype base="integer"/>
        <fd:label>Remote FTP Port</fd:label>
        <fd:validation>
            <fd:range min="1" max="65535"> 
                <fd:failmessage>Remote FTP Port must be a number between 1
and 65535</fd:failmessage>
            </fd:range>
        </fd:validation>
    </fd:field>

The only difference being I my boolean field needs to be false to show the
field. 

HTH



Mime
View raw message