Skip to content

Instantly share code, notes, and snippets.

@cmcdevitt
Last active August 3, 2022 17:55
Show Gist options
  • Select an option

  • Save cmcdevitt/3778c865e3a27f82d9d3989232dfb63e to your computer and use it in GitHub Desktop.

Select an option

Save cmcdevitt/3778c865e3a27f82d9d3989232dfb63e to your computer and use it in GitHub Desktop.
Check a Subcategory / Options to see if it is empty
//Get the DOM Element and it's undocumented
var subcat = g_form.getElement('subcategory');//Any "Choice" List
if(subcat.length > 1){ // i.e. it's not Empty
//Do something cool!
}else{
//Do something cool!
}
/*
Choice List are HTML Options
https://www.w3schools.com/tags/tag_option.asp
*/
/*
You need to wait for the DOM to settle for this to work so use:
window.setTimeout(fun2,5000);
}
This is out side the main onChange function
function fun2(){
// do your stuff here
alert('I waited 5 seconds.');
var caller = g_form.getReference('caller_id');
g_form.setValue('location', caller.location);
}
or in theroy
window.addEventListener('DOMContentLoaded', (event) => {
console.log('DOM fully loaded and parsed');
});
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment