Forcing Javascript validation when chaning form inputs

Talk about add-ons and extension development.
Posts: 1
Joined: February 19th, 2015, 10:45 pm

Post Posted September 15th, 2016, 12:30 am

I am writing an extension to link to my password manager using the addon SDK. Mostly it works but occasionally fails - i think because the page contains a script which needs to run but has not. As an example the Firefox addons login ( ... e/versions) shows this problem. When filling in the page by hand the submit button is enabled as soon as a valid email and password exceeding the min length are entered.

If I change the two input fields values via the extension (node.value = newval;) this does not happen, and if i then submit the form (loosely node.form.submit();) it failswith the message Bad Request - Missing OAuth parameter: client_id.

However if I change the values via extension and then manually tab around all is well.

I have tried changing focus while changing the values, and tried to envoke any onchange as below but I cant get this to work
var event = new Event('change');
Obviously this is possible as the firefox password manager handles this page correctly. Thanks in advance for any help. Al

Posts: 3664
Joined: September 15th, 2010, 9:03 am

Post Posted September 28th, 2016, 10:16 am

The page may be listening to other events. You probably need to watch the page and see what happens when you type manually.

onchange fires if a textbox value has been changed, but not until after it loses focus (or enter is pressed), and not when changing the value from javascript
oninput changes when a user types, but not for some non-visible characters

Return to Extension Development

Who is online

Users browsing this forum: No registered users and 2 guests