Reputation: 839
I have the following form:
<form name="security_page_toplevel_page_itsec_settings" method="post" action="options.php">
<select id="itsec_strong_passwords_roll" name="itsec_strong_passwords[roll]">
<option value="admin">admin</option>
<option value="subscriber">subscriber</option>
</select>
</form>
but I am unable to select the "subscriber" option with the following code:
this.fillSelectors('form#security_page_toplevel_page_itsec_settings', {
'select[name="itsec_strong_passwords[roll]"]': 'subscriber'
}, true);
What am I doing wrong?
Upvotes: 1
Views: 6847
Reputation: 61902
The name attribute of the form is not the same as the id attribute.
You have to select the form
using
this.fillSelectors('form[name="security_page_toplevel_page_itsec_settings"]', {
'select[name="itsec_strong_passwords[roll]"]': 'subscriber'
}, true);
If this does not work, you could try explicitly setting the select option in the page context:
var index = 2; // the index to select, you may calculate the index programatically from the option value
this.evaluate(function(index) {
var sel = document.querySelector('form[name="security_page_toplevel_page_itsec_settings"] select[name="itsec_strong_passwords[roll]"]');
sel.selectedIndex = index;
sel.onchange();
}, index);
Upvotes: 5