Hi, I’ve just recently started with using raspberry pi and started with magic mirror.
I created a module through the template provided, with the use for adding an input field.
I’ve been running into an issue of each time I press the enter key on the keyboard after entering a text in the filed or just having the empty field, the magic mirror restarts itself and I’m back to square one.
This is the code to create it iside the getDom
function:
getDom: function() {
var self = this;
var wrapper = document.createElement("div");
self.config.form = document.createElement("form");
self.config.inputbox = document.createElement("input");
self.config.dropdownFields = document.createElement("select");
self.config.inputbox.setAttribute("type", "text");
self.config.form.appendChild(self.config.inputbox);
self.config.form.appendChild(self.config.dropdownFields);
wrapper.appendChild(self.config.form);
// If this.dataRequest is not empty
if (this.dataRequest) {
self.getInput();
self.getFields();
}
return wrapper;
},
Every time I hit enter it refreshes the whole page.
I’ve also added code for action on change:
self.config.inputbox.onchange = function() {self.setVisibile(self.config.dropdownFields)};
but even without this code it still
The good news is I can notice that the onchange
function works (just before everything is restarted).
Does anyone have any idea why this is like that, do I need to change some settings I am not aware of??
Thank you for any feedback.