You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Alberto Brosich <ab...@ogs.trieste.it> on 2007/09/17 15:43:40 UTC

Reset button doesn't work properly

I have a form with some widgets containing javascript code that set the
selection list of other widgets.
The reset button resets only widgets without javascript code.

Follow the definition of the reset button from the form model:

    <fd:submit id="reset" validate="false">
      <fd:label>Reset</fd:label>
    </fd:submit>

and  the javascript code
...
      <fd:on-value-changed>
      <javascript>
               var value = event.source.value;
              var inswidget = event.source.lookupWidget("../institutes");

              if (value !="") {
                // Get the corresponding institutes list
               
inswidget.setSelectionList("cocoon:/lov-institutes?wherecond=cty_code='"
+ value + "'");
              }
             
              inswidget.value = null;
       </javascript>
       </fd:on-value-changed>

...

and how it's handle with the flowscript
...
        if (form.submitId == "reset") {
          // the user pressed reset
            form.showForm("");
        } else
...

Maybe something about javascript code? I cannot find any useful hint
within cocoon samples.

Thanks in advance

Alberto Brosich


Cocoon 2.1.10
Debian/Linux lenny
Java 1.5



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


Re: Reset button doesn't work properly

Posted by Dev at weitling <de...@weitling.net>.
Hi Alberto,

do you want to perform a reset on the client-side widgets or a reset
i.e. reload of the server-side widgets' data?
In the first case this

	<input type="reset" value="Cancel"/>
or this
	document.myForm.reset();
should do the trick.
Server-side you have either to perform a reload of your bean data with redisplay or to (re)set values by hand.
Anyway it's not completely clear how your code is organized.

Bye,
Florian


Alberto Brosich wrote:
> I have a form with some widgets containing javascript code that set the
> selection list of other widgets.
> The reset button resets only widgets without javascript code.
>
> Follow the definition of the reset button from the form model:
>
>     <fd:submit id="reset" validate="false">
>       <fd:label>Reset</fd:label>
>     </fd:submit>
>
> and  the javascript code
> ...
>       <fd:on-value-changed>
>       <javascript>
>                var value = event.source.value;
>               var inswidget = event.source.lookupWidget("../institutes");
>
>               if (value !="") {
>                 // Get the corresponding institutes list
>                
> inswidget.setSelectionList("cocoon:/lov-institutes?wherecond=cty_code='"
> + value + "'");
>               }
>              
>               inswidget.value = null;
>        </javascript>
>        </fd:on-value-changed>
>
> ...
>
> and how it's handle with the flowscript
> ...
>         if (form.submitId == "reset") {
>           // the user pressed reset
>             form.showForm("");
>         } else
> ...
>
> Maybe something about javascript code? I cannot find any useful hint
> within cocoon samples.
>
> Thanks in advance
>
> Alberto Brosich
>
>
> Cocoon 2.1.10
> Debian/Linux lenny
> Java 1.5
>
>
>
> ---------------------------------------------------------------------
> 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