You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Leonid Chumanov <lc...@framedoc.ru> on 2009/01/12 10:07:39 UTC

Forms, multiply action widgets and ENTER key

Hi, All.

 

I working with CFORMS (cocoon 2.1.11).

 

I have some forms with more than one submit (or action) widgets.  When I
press ENTER (keyboard key) in text field - the form was submitted well.  

My problem: received submitId is id from first action widget in my form.
But I need it from action widget named "apply". 

How can I do this?

 

I try to use simple javascript

 

if (document.layers)

  document.captureEvents(Event.KEYDOWN);

  document.onkeydown =

    function (evt) { 

      var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) :
event.keyCode;

      if (keyCode == 13)   //13 = the code for pressing ENTER 

      {

                        var applyButton = document.getElementById('apply');

                        if (applyButton != null){

                                   applyButton.click();

                        }

                        //

           //document.forms[0].submit(); - this working, but not well 

      }

    }

 

But this javascript does not working well.   

 

 

Thanks.   

Leonid