Change textarea placeholder on profile-search-type selector

This commit is contained in:
Bofh 2022-12-04 00:29:04 +01:00
parent d76fa05683
commit ca8adb33c7
2 changed files with 24 additions and 6 deletions

View File

@ -5,18 +5,19 @@
<input type="text" name="preset_name" placeholder="Preset name" value="Undefined"/>
</div>
<div class="input">
<label for="profile">Profile query:</label>
<label for="profile">Profile content:</label>
<input type="radio" id="profile-search-type-simple"
name="profile_search_type" value="simple" checked
/><label for="profile-search-type-simple">simple</label>
<input type="radio" id="profile-search-type-query"
name="profile_search_type" value="query"
/><label for="profile-search-type-query">query</label>
<input type="radio" id="profile-search-type-expr"
name="profile_search_type" value="expr"
/><label for="profile-search-type-expr">expr</label>
<input type="radio" id="profile-search-type-empty"
name="profile_search_type" value="empty"
/><label for="profile-search-type-empty">Empty</label>
<br class="sep"/>
<textarea name="profile" type="text" style="width: 100%"
<textarea name="profile" type="text"
style="width: 100%; min-width: 24em; min-height: 6em"
placeholder="Input your text here"></textarea>
</div>
<div class="input">

View File

@ -62,9 +62,26 @@ window.view.instance = {
filter_users: function() {
E.http_template('instance/filter-users', function(html) {
E.element('#window-instance #container').innerHTML = html;
E.elemid('profile-search-type-simple').onchange = function(e) {
if (e.target.checked) {
E.element('textarea[name="profile"]').setAttribute('placeholder', 'Input your text here');
E.element('textarea[name="profile"]').removeAttribute('disabled');
}
};
E.elemid('profile-search-type-expr').onchange = function(e) {
if (e.target.checked) {
E.element('textarea[name="profile"]').setAttribute('placeholder', '(words "apple banana" AND contains "i like apples") OR words "pineapple strawberry"');
E.element('textarea[name="profile"]').removeAttribute('disabled');
}
};
E.elemid('profile-search-type-empty').onchange = function(e) {
if (e.target.checked) {
E.element('textarea[name="profile"]').setAttribute('placeholder', '<Profile content is empty>');
E.element('textarea[name="profile"]').setAttribute('disabled', 'disabled');
}
}
E.custom.btncollapse_render();
});
console.log('aaa');
},
},
load_content: function(content, hashload) {