Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Submitting form using Enter button

    Hi,

    I have DynamicForm which I want to have option to submit with Enter button. According to posts on forum I set saveOnEnter property on DynamicForm. But then I got error:

    DynamicForm:isc_DynamicForm_9:saveData() called on a non-databound DynamicForm. This is not supported. for information on databinding of components look at the documentation for the DataSource class. If this was intended to be a native HTML form submission, set the canSubmit property to true on this form.

    So I set canSubmit, but then my page was submitted and refreshed, whcih I don't want.
    I have a modal window with form and button to submit form. On submit (so on click on button) this window is close. How to simulate this with Enter button?

    #2
    same issue to me. Is there any way to skip the server/let response? In my case this response is completely useless. Instead I would love to keep the application...

    Ekki

    Comment


      #3
      First, read the QuickStart Guide to make sure you understand what databinding is and how it's intended to be used. In general, you should be using DataSources for saving data from forms.

      If you are in the special circumstance that you need to submit data to a legacy system that expects data to be sent as an HTTP POST just like an HTML form would send, use a RestDataSource with dataProtocol "postParams".

      Comment


        #4
        Iso,

        from the context it is obvious that the 'legacy option' is used here, which according to your docs 'performs a native HTML submission to the specified action url'. That's what should work and actually does work perfectly. However there's an issue with the result of that process. Any fdb to this would be helpful.

        Anyway, thank you for the general hints on that Guide...

        Ekki

        Comment


          #5
          So again, use the RestDataSource for this use case, not native submission.

          Comment


            #6
            one more pointer please, maybe an example? I've an UploadItem and an action url supporting those http post's... where to insert the RestDS... thanks Ekki

            Comment


              #7
              For Upload, see the Upload overview, FileItem, and the upload example in the EE Showcase. It does not involve a RestDataSource.

              Comment


                #8
                I got round this by doing the following

                Code:
                passwordItem.addKeyPressHandler(new EnterKeyHandler());
                with the listener being

                Code:
                private final class EnterKeyPressHandler implements KeyPressHandler {
                
                
                		@Override
                		public void onKeyPress(KeyPressEvent event) {
                			
                			if(event.getKeyName() != null) {
                				if(event.getKeyName() != null) {
                					String keyName = event.getKeyName();
                					if(keyName.equals("Enter")) {
                						loginButtonPerformed();
                					}
                					
                				}
                			}
                		}
                
                	}
                So when the user enters his username, and then enters his password and clicks enter the form validates and submits

                Comment

                Working...
                X