We configured our instance to do something similar, completely in the form and based on a Javascript function using detailMakeReq() called with the onBlur event on the Category . This example is for the detail_chg.htmpl but can be easily modified for detail_cr / in / pr. If however you need the error dialog to display on a completely different form than these you'll need to include a couple of extra lines.
var saveAckMsgExtra = "${args.trigger_message:}";
var error_msg = '<PDM_FMT ESC_STYLE=JS2>$args.ERROR_MSG</PDM_FMT>'; // These two go immediately after the var form_title variable.
var argHumantouchLog = "$args.KEEP.humantouch_log"; // This goes in the script section immediately following <PDM_INCLUDE FILE=std_head.htmpl>
var prop_ref = "${prop_ref:}"; // This goes right before the CA .js files are called
******************************************************************
function set_required_fields_by_category()
{
//var a = document.getElementsByName("SET.chgtype")[0]; // 'Type' Dropdown
var b = document.getElementById("df_0_3").value; // 'Category'
var c = b.substr(0, 5).toLowerCase();
var d = b.substr(0, 4).toLowerCase();
if ( c != "" ) {
if ( c == "cc ex" ) {
// If the category = 'CC Express' then make 'Authorized Approver' and 'Schedule Start Date' required
detailMakeReq("zapprover,sched_start_date");
detailMakeReq("effort,backout_plan", true);
} else if ( c == "cc em" ) {
// If the category == 'CC Emergency' then make 'Authorized Approver' and 'Schedule Start Date' required
detailMakeReq("zapprover,sched_start_date");
detailMakeReq("effort,backout_plan", true);
} else if ( d == "cc r" ) {
// If the category = 'CC Routine' then make 'Implementation Plan', 'Backout Plan', 'Schedule Start Date' required
detailMakeReq("effort,backout_plan,sched_start_date");
detailMakeReq("zapprover", true);
} else if ( d == "cc o" ) {
// If the category = 'CC Operational' then make none of these fields required
detailMakeReq("effort,backout_plan,sched_start_date", true);
detailMakeReq("zapprover", true);
// If the category = 'CC Downtime' then make none of these fields required
} else if ( d == "cc d" ) {
detailMakeReq("effort,backout_plan,sched_start_date", true);
detailMakeReq("zapprover", true);
// Otherwise make none of these fields required
} else {
detailMakeReq("effort,backout_plan,sched_start_date", true);
detailMakeReq("zapprover", true);
}
}
}
Derek~