vendredi 29 janvier 2021

How to prevent Enter causing Dojo website to reload

I have a Dojo Dialog and within it there is a Form, TextBox and Button. When the Form is open and I type something in the TextBox and press Enter, the entire website reloads. How can I prevent this? Clicking the OK button works as expected. Is there a way I can disable the Enter behavior?

    var form = new Form();

    new TextBox({
        placeHolder: "enter value:"
    }).placeAt(form.containerNode);

    new Button({
      label: "OK", 
      'onClick': function () {
        console.log(`form value is: ${form._descendants[0].value}`)
        dia.hide();
      },
    }).placeAt(form.containerNode);

    var dia = new Dialog({
      content: form,
      title: "Save",
      style: "width: 300px",
  });

  form.startup();
  dia.show();



Aucun commentaire:

Enregistrer un commentaire