You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Carsten Ziegeler <cz...@apache.org> on 2005/09/13 13:41:59 UTC

[CForms] Several forms per page?

The forms.lib.js contains this snippet:

// Handlers that are to be called in form's "onsubmit" event
// FIXME: this single var implies only one form per page, and needs tobe
//       visited if we decide to support several forms per page.
var forms_onsubmitHandlers = new Array();

Now, what does this actually mean if I have several forms per page? I'm
currently thinking of the portal having different portlets each with an
own form.

Carsten
-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/

Re: [CForms] Several forms per page?

Posted by Sylvain Wallez <sy...@apache.org>.
Carsten Ziegeler wrote:

>Sylvain Wallez wrote:
>  
>
>>So I think we should deprecate this and replace it with a per-form 
>>system (i.e. attaching these handles to the form object itself). 
>>    
>>
>+1
>
>  
>
>>A way 
>>to enforce this feature isn't used in the portal is to replace the 
>>"push" method of the forms_onsubmitHandlers object by an alert:
>>
>>  forms_onsubmitHandlers.push = function() {
>>    alert("You cannot use form_onsubmitHandlers in the portal") }
>>
>>    
>>
>Hmm, but this is only required if I have more than one form on the
>portal page, or?
>  
>

Yes. So this alert thing could be added only if several CForms on a 
single page (other kind of forms are ok). Now we have to find a way to 
detect this...

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://people.apache.org/~sylvain     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Re: [CForms] Several forms per page?

Posted by Carsten Ziegeler <cz...@apache.org>.
Sylvain Wallez wrote:
> 
> So I think we should deprecate this and replace it with a per-form 
> system (i.e. attaching these handles to the form object itself). 
+1

> A way 
> to enforce this feature isn't used in the portal is to replace the 
> "push" method of the forms_onsubmitHandlers object by an alert:
> 
>   forms_onsubmitHandlers.push = function() {
>     alert("You cannot use form_onsubmitHandlers in the portal") }
> 
Hmm, but this is only required if I have more than one form on the
portal page, or?

Carsten

-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/

Re: [CForms] Several forms per page?

Posted by Sylvain Wallez <sy...@apache.org>.
Carsten Ziegeler wrote:

>The forms.lib.js contains this snippet:
>
>// Handlers that are to be called in form's "onsubmit" event
>// FIXME: this single var implies only one form per page, and needs tobe
>//       visited if we decide to support several forms per page.
>var forms_onsubmitHandlers = new Array();
>
>Now, what does this actually mean if I have several forms per page? I'm
>currently thinking of the portal having different portlets each with an
>own form.
>  
>

This feature is a provision for the case where some widget 
implementations need to perform some special actions such as copying 
some visible fields to hidden ones. The only widget implementation that 
uses it is the double listbox (see form.js/forms_createOptionTransfer) 
which could be refactored in order not to use it.

However, there has been some posts on the mailing lists showing that 
some people use it to plug in some client-side validation.

So I think we should deprecate this and replace it with a per-form 
system (i.e. attaching these handles to the form object itself). A way 
to enforce this feature isn't used in the portal is to replace the 
"push" method of the forms_onsubmitHandlers object by an alert:

  forms_onsubmitHandlers.push = function() {
    alert("You cannot use form_onsubmitHandlers in the portal") }

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://people.apache.org/~sylvain     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director