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?
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?
Share Improve this question edited Mar 29, 2016 at 19:18 Artjom B. 62k26 gold badges135 silver badges230 bronze badges asked May 8, 2014 at 17:09 SulliSulli 8671 gold badge14 silver badges39 bronze badges 01 Answer
Reset to default 5The 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);
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744837515a4596353.html
评论列表(0条)