Glen Ezkovich wrote:
Some how I missed this yesterday when I sent my post and consequently sent garbage. I apologize for the noise.


On Nov 22, 2004, at 4:12 AM, Reinhard Poetz wrote:

Upayavira wrote:

Hi,
I need to put two forms onto one page.
Scenario: a homepage showing a selection of 'products', displayed as a repeater on a form, and a login form.
These need to be separate HTML forms, so that typing into a box and pressing enter submits the relevant form.
Is there a way to do this without having to go all the way and aggregate two completely separate pipelines? Having to do the this for just one page would be a real pain.
Thanks for any ideas.


AFAIK this is an open issue for cForms. Therefore I move it over to dev-list.

I think one problem is our flowscript API:


This is exactly what I was thinking.


var form = new Form("..."); form.show("mypipeline", bizdata);

This way you can only show one form a page. Maybe we can do somethink like

 var multiform = new Multiform({form1 : form1, form2 : form2);
 multiform.show("myMultiformPipeline", bizdata);


I think where we see thing differently is that I would rather have the forms as just part of a page, i.e. cocoon.sendFormPage("formTemplate.xml", {"bizdata": bizdata}, {"formURI1", "formURI2", ..., "formURIn"})

This wouldn't work because this way you would have to care of validation and "continuation management" in every controller using forms.


Actually, I would like it better if the forms can just be referenced in the template and sendFormPage returns an array of Forms. I'm not sure what type of performance hit this might cause.



The next step would have to be an enhancement of the forms transformer because it would have to render more than one form. This would probably require a unique id in the forms template. This id needs to be the same as the id used in "new Multiform(...)".


One of the ideas I've been tossing about is the notion of named forms. Now when I say named forms I don't necessarily mean an arbitrary name, since it seems obvious that names should be unique. It could simply be the URI of the form; forms/myForm.xml. This, I think would work for your unique ID as well.

In a recent proof of concept project not only did we needed multiple forms per page but we discovered that we had many forms that shared groups of information such as address information. It would have been nice to be able to create the form definition and the form template just once and just include it in other forms that needed to display or collect that information. (I know it is possible but not straightforward)

As an example of what I have in mind is something along the lines of the following:

    In wholeForm.xml:

<fd:form>
<fd:widgets>
<fd:include name="name" submit="false"/>
<fd:include name="address" submit="true"/>
<fd:include name="someOtherStuff" submit="action" action-command="doThis" on-action="whatever"/>
<fd:submit id="alldone" action-command="..." validate="true">
<fd:label>Submit</fd:label>
<fd:help>...</fd:help>
<fd:hint>...</fd:hint>
<fd:on-action>
...
</fd:on-action>
</fd:widgets>
</fd:form>


And in wholeFormTemplate.xml

    <ft:form-template action="#{$continuation/id}.continue" method="POST">
        <ft:include name="name"/>
        <ft:include name="address"/>
        <ft:include name="someOtherStuff"/>
        <ft:widget id="alldone"/>
    </ft:form-template>

My thinking at the time was that named forms would solve both multiple forms per page and shared form elements. I now see the two issues are independent but named forms would make the use of multi-form pages easier by simply allowing passing the form names to the showFormPage function.

I don't understand the include syntax. what does it include?


As I mentioned above, form names could be just their URI, but they could also be specified in the sitemap allowing for simple form replacement. While I realize this is a huge undertaking since it touches many pieces, it does not have to break backwards compatibility.


If the project proceeds I will scratch this itch. If it doesn't I may have a lot of time on my hands ;-0 and a lot of nervous scratching might take place anyway.

Again, any thoughts on this would be greatly appreciated.


--
Reinhard

Reply via email to