[Dojo-interest] form submit in ContentPanes

Christian Thies christian.thies at go-community.de
Wed Feb 7 09:48:26 MST 2007


...
DEBUG: [Error: FormBind: Couldn't apply, invalid form, file: 
http://control.viani.demo.go-community.de/_javascript/dojo-0.4.1-ajax/dojo.js, 
line: 2613] when calling __77$joinpoint$method on [Widget 
dojo:contentpane, display] with arguments [object Object]
FATAL exception raised: FormBind: Couldn't apply, invalid form


Rose, Ryan schrieb:
> Try using dojo.io.FormBind on your form. Then when the result is returned you can set the display with the results returned from the server.
>
> Add this to your ContentPane to bind the form after your page loads: onLoad="postForm('o_ShopItem');"
>
> function postForm(form) {
> 	var e = $(form);
> 	var x = new dojo.io.FormBind({
> 		formNode: e,
> 		load: function(type, data, evt) {
> 		    //display results data here
> 			dojo.byId("results").innerHTML = data;
> 		},
> 		error: function(t, e) {
> 	       //handle errors from server here
> 		}
> 	});
>
>  	x.onSubmit = function(form) {
>     	//do your validation here
>     	return true; // needed to submit form
>     }
> }
>
> Regards,
> Ryan Rose
> http://www.digiwize.com
>
> -----Original Message-----
> From: dojo-interest-bounces at dojotoolkit.org [mailto:dojo-interest-bounces at dojotoolkit.org] On Behalf Of Christian Thies
> Sent: Wednesday, February 07, 2007 10:54 AM
> To: Dojo-interest at dojotoolkit.org
> Subject: [Dojo-interest] form submit in ContentPanes
>
> Hi everybody!
>
> I'm trying to submit forms within a dynamically loaded ContentPane, like
> ...
> <div id="dw_content" dojoType="ContentPane" widgetId="display" 
> layoutAlign="client" cacheContent="false" 
> href="/_framesets/start_content.html" preventCache="true" 
> useCache="false" refreshOnShow="true" executeScripts="true">
> </div>
> ...
>
> After loading another url to that pane via 
> "dojo.widget.byId('display').setUrl('/commerce/item_group_content.html');" 
> I wonder how to manage submitting the form of 
> "/commerce/item_group_content.html" such that the results are showing in 
> "display" again.
> ...
> <form name="o_ShopItem" action="/commerce/item_group_content.html" 
> method="post">
> ...
>
> I've managed to catch the "onsubmit" event - if some <input 
> type="submit"> is pressed:
> ...
>                 dojo.event.connect(display.domNode, "onsubmit", 
> 'relaySubmits');
> ...
>             function relaySubmits(evt){
>                 var form = evt.target;
>                 alert("submit "+form.name);
>             }
> ...
> But if the form is submitted by a javascript call 
> "document.forms[0].submit();" I don't catch anything at all :(
>
> So, how can I catch "submit();"-calls, and how is it going further on? 
> Have I to loop over all elements of the form and concatenate the url 
> myself to finally "display.setUrl(url)"?
>
> I sense that there is a "cheaper" way ...
>
> Thanks,
> Christian
>
>
>
>   

-- 
Anwendungsentwicklung

BLACKBIT interactive GmbH | BLACKBIT Viani GmbH
Ernst-Ruhstrat-Str. 6 - D-37079 Goettingen

tel.: +49-551-50675-50 - fax.: +49-551-50675-55
email: christian.thies at go-community.de

Klassische Werbung und Online-Marketing: http://www.blackbit.de
Software für Online-Marketing: http://www.go-community.de



More information about the Dojo-interest mailing list