You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Myriam Delperier <my...@ajlsm.com> on 2006/02/14 11:38:37 UTC
cforms pb with fd:on-value-changed
hello,
I'm working this cforms.
My forms are OK except for one thing :fd:on-value-changed :
<fd:field id="dossier.type" required="true">
<fd:label><i18n:text i18n:catalogue="biosec"
key="dossier.type"/></fd:label>
<fd:datatype base="string"/>
<fd:selection-list src="cocoon:/listes/dossier_type.xml"/>
<fd:on-value-changed>
<javascript>
java.lang.System.err.println("Was here!");
java.lang.System.out.println("Was here!");
print("was here");
var datatype = event.source;
var value = datatype.value; // value of datatype
print("value");
var users = datatype.parent.lookupWidget("dossier.organisme.nom");
if (value!="") {
users.setSelectionList("cocoon:/listes/organisme_cgb.xml");
datatype.value = "";
}
</javascript>
</fd:on-value-changed>
</fd:field>
even if i change the value of my list, nothing is printed and the value
of the other list isn't changed.
I think the javascript isn't read.
do you have an idea of what the problem can be?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: cforms pb with fd:on-value-changed
Posted by Myriam Delperier <my...@ajlsm.com>.
Simone Gianni wrote:
| | Hi Myriam,
| | yes, the fd;on-value-changed is the right way to do it.
| |
| | The typical case is the state/region/province/town selections, where
| | selecting a state must populate the regions dropdown with the right
| | regions and so on. This is done with an fd:on-value-changed listener
| | that populates the other selection list with proper data. Simply,
| | add
| | the <fi:styling submit-on-change="true"/> to the field in the
| | template, so that the form will be submitted and the server side
| | listener has the possibility to run when the user selects a value
| | in the drop down.
ok, thank you very much
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: cforms pb with fd:on-value-changed
Posted by Simone Gianni <s....@thebug.it>.
Hi Myriam,
yes, the fd;on-value-changed is the right way to do it.
The typical case is the state/region/province/town selections, where
selecting a state must populate the regions dropdown with the right
regions and so on. This is done with an fd:on-value-changed listener
that populates the other selection list with proper data. Simply, add
the <fi:styling submit-on-change="true"/> to the field in the template,
so that the form will be submitted and the server side listener has the
possibility to run when the user selects a value in the drop down.
Also consider that on some browsers (internet explorer) the change event
is not triggered until the user clicks away from the field. This is done
to avoid generating a lot of events while the user is simply browsing
the available options, or typing the first few letters in a text field.
This happens on some fields, like radio and check buttons, but may
happen also on drop downs, depends on browsers.
Myriam Delperier wrote:
> Simone Gianni wrote:
> | | Hi Myriam,
> | | the fd:on-value-changed is a SERVER SIDE event handler. So it's
> | | triggered when the form is submitted by the browser. You can force
> | | the browser to submit the form whenever a given widget value is
> | | changed | | using the <fi:styling submit-on-change="true"/> in the
> form
> | | template (it should do this automatically if there is a listener,
> | | but since it's not working in your case you can make it explicit).
>
> ok , so that's not the solution of my problem.
> i've got 2 lists in my form
> and the uri of the second one depends of the value of the first one
> how can i do this ?
>
> ---------------------------------------------------------------------
> 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: cforms pb with fd:on-value-changed
Posted by Myriam Delperier <my...@ajlsm.com>.
Simone Gianni wrote:
| | Hi Myriam,
| | the fd:on-value-changed is a SERVER SIDE event handler. So it's
| | triggered when the form is submitted by the browser. You can force
| | the browser to submit the form whenever a given widget value is
| | changed
| | using the <fi:styling submit-on-change="true"/> in the form
| | template (it should do this automatically if there is a listener,
| | but since it's not working in your case you can make it explicit).
ok , so that's not the solution of my problem.
i've got 2 lists in my form
and the uri of the second one depends of the value of the first one
how can i do this ?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: cforms pb with fd:on-value-changed
Posted by Simone Gianni <s....@thebug.it>.
Hi Myriam,
the fd:on-value-changed is a SERVER SIDE event handler. So it's
triggered when the form is submitted by the browser. You can force the
browser to submit the form whenever a given widget value is changed
using the <fi:styling submit-on-change="true"/> in the form template (it
should do this automatically if there is a listener, but since it's not
working in your case you can make it explicit).
Note that this will trigger a page reload every time the value of the
widget is changed by the user, which can be annoying if used in many
places; to solve this you may try ajax.
If you want a certain CLIENT SIDE javascript get called when the value
of a widget changes, you can specify <fi:styling
onchange="myJavascriptFunction()"/>. The loading of the client side
javascript must be handled with your site specific XSL.
Hope this helps,
Simone Gianni
Myriam Delperier wrote:
> | | even if i change the value of my list, nothing is printed and the
> | | value of the other list isn't changed.
> | | I think the javascript isn't read.
> | |
> in fact the print is done once the form is submited,
> is it normal?
>
> ---------------------------------------------------------------------
> 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: cforms pb with fd:on-value-changed
Posted by Myriam Delperier <my...@ajlsm.com>.
| | even if i change the value of my list, nothing is printed and the
| | value of the other list isn't changed.
| | I think the javascript isn't read.
| |
in fact the print is done once the form is submited,
is it normal?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org