You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by David Leangen <dl...@canada.com> on 2004/12/06 04:59:55 UTC

Problems with event handling in CForms

Hello!

I'm having a bit of trouble with event handling in CForms.

What is the element that I'm missing that will trigger a page update? I
can't seem to figure that out...



This is the function in my flow controller:

function showLimitsForm()
{
    var form = new Form("limits.xml");
    form.lookupWidget("age").setValue(cocoon.parameters.defaultAge);
    form.showForm("limits-display-pipeline");
    cocoon.request.setAttribute("ageselectorform", form.getWidget());
    cocoon.sendPage("limits-success-pipeline.jx", bizdata);
}


This is an excerpt of my form definition:


<fd:form
  xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
  xmlns:i18n="http://apache.org/cocoon/i18n/2.1">

  <fd:widgets>

    <fd:field id="age">
      <fd:label>Age</fd:label>
      <fd:datatype base="string"/>
      <fd:selection-list src="cocoon:/age" dynamic="true"/>
      <fd:on-value-changed>
        <javascript>
          var thisWidget = event.source;

          ...
          ...


(Is it even necessary to use 'src="cocoon:/age"'? The contents of the list
are not dynamic.)


This is an excerpt from my template file:


  <ft:widget id="age">
    <fi:styling list-type="radio" submit-on-change="true"/>
  </ft:widget>


However, when I change the value of the "age" radio, no event is being
triggered...


Any ideas?




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Problems with event handling in CForms

Posted by Upayavira <uv...@upaya.co.uk>.
David Leangen wrote:

>Hi, Sylvain,
>
>Thanks for the suggestion.
>
>  
>
It's okay to have a submit button, just don't give it an ID or name of 
"submit". Call it something else. That's all.

Regards, Upayavira

>>Do you have a widget that is named "submit"? If yes, it overrides the
>>submit() function of the form object in the web page, and therefore
>>breaks the client-side handling of "submit-on-change".
>>    
>>
>
>Yes, I have a submit button. Actually, I need a submit button.
>
>Actually, what I'm trying to do isn't all that complicated, I think. It's
>that that I haven't found the right combination of settings I need to get
>the job done.
>
>My form should be like this:
>
>-------------------------
> (  ) radio1
> (  ) radio2
>      [  ] checkbox1
>      [  ] checkbox2
>
>  [  submit  ]
>-------------------------
>
>
>When radio1 is set, both checkboxes should be disactivated.
>
>When radio2 is set, the checkboxes should be activated.
>
>
>However, I'm not able to capture the event indicating the change of values
>between radio1 and radio2. I think that's pretty much the only thing I
>haven't figured out yet.
>
>
>Any suggestions are very welcome.
>
>Thanks!
>Dave
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


RE: Problems with event handling in CForms

Posted by David Leangen <dl...@canada.com>.
Hi, Sylvain,

Thanks for the suggestion.

> Do you have a widget that is named "submit"? If yes, it overrides the
> submit() function of the form object in the web page, and therefore
> breaks the client-side handling of "submit-on-change".

Yes, I have a submit button. Actually, I need a submit button.

Actually, what I'm trying to do isn't all that complicated, I think. It's
that that I haven't found the right combination of settings I need to get
the job done.

My form should be like this:

-------------------------
 (  ) radio1
 (  ) radio2
      [  ] checkbox1
      [  ] checkbox2

  [  submit  ]
-------------------------


When radio1 is set, both checkboxes should be disactivated.

When radio2 is set, the checkboxes should be activated.


However, I'm not able to capture the event indicating the change of values
between radio1 and radio2. I think that's pretty much the only thing I
haven't figured out yet.


Any suggestions are very welcome.

Thanks!
Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Problems with event handling in CForms

Posted by Sylvain Wallez <sy...@apache.org>.
David Leangen wrote:

>Hello!
>
>I'm having a bit of trouble with event handling in CForms.
>
>What is the element that I'm missing that will trigger a page update? I
>can't seem to figure that out...
>
>
>
>This is the function in my flow controller:
>
>function showLimitsForm()
>{
>    var form = new Form("limits.xml");
>    form.lookupWidget("age").setValue(cocoon.parameters.defaultAge);
>    form.showForm("limits-display-pipeline");
>    cocoon.request.setAttribute("ageselectorform", form.getWidget());
>    cocoon.sendPage("limits-success-pipeline.jx", bizdata);
>}
>
>
>This is an excerpt of my form definition:
>
>
><fd:form
>  xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
>  xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
>
>  <fd:widgets>
>
>    <fd:field id="age">
>      <fd:label>Age</fd:label>
>      <fd:datatype base="string"/>
>      <fd:selection-list src="cocoon:/age" dynamic="true"/>
>      <fd:on-value-changed>
>        <javascript>
>          var thisWidget = event.source;
>
>          ...
>          ...
>
>
>(Is it even necessary to use 'src="cocoon:/age"'? The contents of the list
>are not dynamic.)
>
>
>This is an excerpt from my template file:
>
>
>  <ft:widget id="age">
>    <fi:styling list-type="radio" submit-on-change="true"/>
>  </ft:widget>
>
>
>However, when I change the value of the "age" radio, no event is being
>triggered...
>
>
>Any ideas?
>  
>

Do you have a widget that is named "submit"? If yes, it overrides the 
submit() function of the form object in the web page, and therefore 
breaks the client-side handling of "submit-on-change".

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org