PennController for IBEX › Forums › Support › Filled TextInput › Reply To: Filled TextInput
Hi Ana,
You inserted the code at the right place, there only are two minor problems:
– your TextInput element is named "inputNasc"
so you need to update the querySelector line: const ipt = document.querySelector(".PennController-TextInput-container.PennController-inputNasc-container textarea");
– you have a wait
on the TextInput element before you call the Function element, so the function will only be called after a keypress on Enter, at which point it is too late for the function to have any effect, really; simply add a getTextInput("inputNasc")
after your Function element’s call
command (don’t forget the separating comma) and attach the wait
lines to that getTextInput
instead, so that you wait for a keypress after the function has been executed
Two last notes:
– you haven’t added the CSS rules to Aesthetics/PennController.css yet—the function will work without them, but the rendering will look very messy (even more so given the long list of cities you have)
– you might want to change the local.filter
line to sug = local.filter(v=>v.match(new RegExp("^"+ipt.value, "i")));
so you only keep the suggestions that start with what’s in the text box, rather than any suggestion that simply contains what’s in the text box anywhere (notice the addition of "^"+
)
Jeremy