El lun, 10-07-2006 a las 14:38 +0200, Paloma Gomez escribió:
> Hi all,
> 
> I'm implementing a cforms usecase and I'm having trouble with the way
> of cancelling it. I've implemented it as suggested in the file
> dynamicrepeater_template.xml included in the cforms module. It says:
> 

Hi Paloma,

I just had a quick look but it seems that the cform example in the trunk
is broken. I cannot submit anymore. Canceling is not working either.

http://lenya.zones.apache.org:9999/default/authoring/doctypes/cforms.html?&lenya.usecase=edit.cforms

I just fixed this (I hope) with r421571 but the server will be updated
tonight.

> 
> [quote]
> <ft:form-template method="POST" ajax="true">

That needs to have ajax="false", I fixed the sample. 

> ...
> ...
>    <input type="hidden" id="lenya.submit" name="lenya.submit" value="ok"/>
> ...
> ...
>  <ft:widget id="ok"/>
>       <!-- If you want a cancel button you beware to change the
> lenya.submit value!!! like: -->
>       <br/>
>       <input i18n:attr="value" type="submit" name="cancel"
> value="Cancel" 
> onClick="document.getElementById('lenya.submit').value='cancel'"/>
> ...
> ...
> [/quote]
> 
> I've added a cancel widget in my form definition (otherwise I get an
> error message) 

You cannot use the a cancel widget since it acts different then we
expect in the usecase.js.

> and have implemented the submit and cancel buttons
> following this example. It doesn't work because clicking on the Cancel
> button generates the following request parameters, among others:
> 
> [quote]
> PARAM: 'forms_submit_id' VALUES: '[cancel]'
> PARAM: 'lenya.submit' VALUES: '[cancel]'
> [/quote]
> 
> and they don't match the following if-else clause in usecases.js:
> 
> [code]
>  //HEADSUP: Cform do not allow id="submit" anymore. Use id="ok" for
> now (till it is settled on cocoon-dev).
> if (cocoon.request.getParameter("submit")||
>    cocoon.request.getParameter("lenya.submit")=="ok") {
> 
> //Execute the usecase
> 
> } else if (cocoon.request.getParameter("cancel")) {
> 
> //Cancel the usecase
> 
> }
> [/code]
> 
> I'm new to Cforms  and I don't know why the cancel button changes its
> name to forms_submit_id when the form is submitted.

Because the cform integration is more a hack in the usecase.js then
anything else. We would welcome a better integration but till now no one
found the time. 

The setting of the hidden (!!!) field lenya.submit to cancel is a
workaround to trigger a cancel.

> 
> I'd like to know if I'm missing something obvious or if  there is a
> workaround to this problem.

Please try again after an update. If it still fails or if it works,
please let us know.

> 
> Thanks,
> 
> Paloma

salu2
-- 
Thorsten Scherler
COO Spain
Wyona Inc.  -  Open Source Content Management  -  Apache Lenya
http://www.wyona.com                   http://lenya.apache.org
[EMAIL PROTECTED]                [EMAIL PROTECTED]


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

Reply via email to