Hi,

I'm using javascript in my cocoon form definition file to validate a
widget (cocoon v2, tomcat4).

I want to check that endTime is greater than startTime but am having
trouble accessing the startTime widget's value from the endTime widget
(for which the validation applies).

I'd appreciate any help (I really hope this can be done!).

Here's a code snippet of the widgets in question:

<fd:field id="eventStartTimeCode" required="true">
    <fd:label>Event Start Timecode<br/>(Format HH:MM:SS:FF)</fd:label>
    <fd:datatype base="string" />
    <fd:validation>
        <fd:regexp
pattern="(([0-1][0-9])|(2[0-3]))\:(([0-5][0-9]\:){2})([0-9][0-9]\/[0-9][0-9])">
            <fd:failmessage>Invalid time code: hh:mm:ss:ff/FF</fd:failmessage>
        </fd:regexp>
    </fd:validation>
   </fd:field>
   
   <fd:field id="eventEndTimeCode" required="true">
    <fd:label>Event End Timecode<br/>(Format HH:MM:SS:FF)</fd:label>
    <fd:datatype base="string" />
    <fd:validation>
        <fd:regexp
pattern="(([0-1][0-9])|(2[0-3]))\:(([0-5][0-9]\:){2})([0-9][0-9]\/[0-9][0-9])">
            <fd:failmessage>Invalid time code: hh:mm:ss:ff/FF</fd:failmessage>
        </fd:regexp>
        <fd:javascript> <!--CANNOT REFERENCE eventStartTimeCode FROM HERE-->
            var endTimecode = widget.getValue();
            var endHour = endTimecode.substring(0,2);
            var endMin = endTimecode.substring(3,5);
            var endSec = endTimecode.substring(6,8);
            
            var startTimecodeWidget = lookupWidget("eventStartTimeCode");
            var startTimecode = startTimecodeWidget.getValue;
            var startHour = startTimecode.substring(0,2);
            var startMin = startTimecode.substring(0,2);
            var startSec = startTimecode.substring(0,2);
            
            print("startTimecode: " + startTimecode);
            print("endTimecode: " + endTimecode);
            
            return timecheck(endHour, endMin, endSec, startHour,
startMin, startSec);
            
            //FUNCTION
            function timecheck(e_hh, e_mm, e_ss, s_hh, s_mm, s_ss)
            {
                return true;
            }
            
        </fd:javascript>
    </fd:validation>
   </fd:field>

Cheers,

Greg

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

Reply via email to