- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2017 10:54 AM
I want to make a UI action show up when certain fields are filled in without having to hit save. Hence using a onChange Client script. I've tried the below but no luck. Any help would be appreciated.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var items = $$('BUTTON').each(function(item){
if(item.innerHTML.indexOf('Create JIRA') > -1){
item.show();
}
});
}
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2017 01:07 PM
I was wrong, the above works if you do it correctly. But now I'm having another problem. When I change the value of one of the fields back to -None- it isn't taking the button away. Any ideas?
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var issType = g_form.getValue('u_issue_type');
var jPri = g_form.getValue('u_jira_priority');
var jProj = g_form.getValue('u_jira_project');
if (issType != '' && jPri != '' && jProj != ''){
var items = $$('BUTTON').each(function(item){
if(item.innerHTML.indexOf('Create JIRA') > -1){
item.show();
}
});
}
else {
var items2 = $$('BUTTON').each(function(item){
if(item.innerHTML.indexOf('Create JIRA') > -1){
item.hide();
}
});
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2017 11:05 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2017 01:07 PM
I was wrong, the above works if you do it correctly. But now I'm having another problem. When I change the value of one of the fields back to -None- it isn't taking the button away. Any ideas?
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var issType = g_form.getValue('u_issue_type');
var jPri = g_form.getValue('u_jira_priority');
var jProj = g_form.getValue('u_jira_project');
if (issType != '' && jPri != '' && jProj != ''){
var items = $$('BUTTON').each(function(item){
if(item.innerHTML.indexOf('Create JIRA') > -1){
item.show();
}
});
}
else {
var items2 = $$('BUTTON').each(function(item){
if(item.innerHTML.indexOf('Create JIRA') > -1){
item.hide();
}
});
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2017 10:51 AM
Based on your script, what it does is: UI action shows up only when all three fields are filled. Also, this is an onChange script, so which field are you firing this off? This will be triggered only when that particular field changes.
So, when you change one of your values to None, first thing is: if its not the field the script is based on, then it wont be triggered. And even if its triggered, since the other fields are filled in, the UI action is still displayed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2019 04:05 AM