On enter action for date

1
Use case:  Adding date and year in application  On click on tab button it is moving to next available field But, on click on Enter it is not moving to next available field Requirement: On click on Enter button also it has to work like tab button works How should i achieve this requirement ?    
asked
1 answers
1

In your text fields, configure an "On Enter Key Press Event". There, select a nanoflow, and in it make a javascript action that does the following:

 

  const currentElement = document.activeElement;
  if (currentElement) {
    const tabEvent = new KeyboardEvent("keydown", {
      key: "Tab",
      bubbles: true,
      cancelable: true,
    });
    currentElement.dispatchEvent(tabEvent);
  }

There are fancier ways to do this, but this is probably the simplest - this one just simulates a tab press as soon as you press enter in a field.

answered