Hi,

I have a form that needs to change the view in a zone on a page. So I
use the new (5.0.11-SNAPSHOT) form with a zone (fantastic stuff,
Howard!)

        <t:form t:id="choose" zone="allocations">
                <t:label for="liquidated">
                        Show liquidated funds
                </t:label>
                <t:checkbox t:id="liquidated" value="liquidatedShown"
onClick="this.form.onsubmit()"/>
                 <input type="submit" value="Choose"/>
        </t:form>

        <t:zone t:id="allocations">
                <t:delegate to="block:allocationsForm" />
        </t:zone>

Rather than using the submit button, I want to submit the form when
the state of the checkbox changes. I discovered fairly quickly that
using 'this.form.submit()' posts directly and circumvents the
javascript, but some digging showed that this.form.onsubmit() does the
job.

This works fine, but I get a javascript error out of Tapestry.js:

The error is at line 159 below, because the event is undefined. Would
it be possible to check for an undefined event here? Or is there some
way in which I can add an event to the onSubmit()?

I'd appreciate any suggestions!

Cheers,

Adriaan

142 if (element.tagName == "FORM")
143 {
144 // The existing handler, if present, will be responsible for form
validations, which must
145 // come before submitting the form via XHR.
146
147 var existingHandler = element.onsubmit;
148
149 var handler = function(event)
150 {
151 if (existingHandler != undefined)
152 {
153 var existingResult = existingHandler.call(element, event);
154 if (! existingResult) return false;
155 }
156
157 element.request({ onSuccess : successHandler });
158
159 event.stop();
160
161 return false;
162 };
163
164 element.onsubmit = handler;
165
166 return;
167 }

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

Reply via email to