Skip to main content
19-Tanzanite
January 3, 2025
Solved

Message Popup on Custom JSP in Workflow

  • January 3, 2025
  • 1 reply
  • 1262 views

Version: Windchill 12.1

 

Use Case: We have custom jsp pages for workflows and would like to have a couple of popups to help guide users in what is expected.


Description:

Let's say we have an attribute called "Validation" and we want to have an information popup to explain how this should be done.  How would I do this in the custom jsp template?  Kind of like on the page to create this there is an "i" next to Message Tags and Labels.

1 reply

avillanueva
23-Emerald I
23-Emerald I
January 3, 2025

Did you want to do validation or just have something like a mouse over or tooltip text? We did a validation that is triggered off the complete button which we had to override the completeButton.jsp to insert a called to a javascript. That javascript is where its all done:

completeTask.setButton(true);
//completeTask.setEnabled(true);
completeTask.setTitle("Complete Task");
completeTask.setDesc("Complete Task");
completeTask.setEnabled((!myNmWorkItem.isCompleted() && !myNmWorkItem.isSuspended() && myNmWorkItem.isMine()));
//10-24-2024 addition - Parent JSP page must contain this validtion script
completeTask.setOnClick("validate_Complete()");

This calls the validate_Complete() function where in my case, I can checking to see if comments were entered for a variable called comments and that a checkbox was checked:

function validate_Complete()
{
 var c=document.getElementsByTagName("textarea")
 var comment;
 for (var k=0; k<c.length; k++)
 {
 if (c[k].name.indexOf("comments")!=-1)
 {
 comment=c[k];
 break;
 }
 }
 if (IsEmpty(comment))
 {
 alert("Please enter comments");
 return false;
 }
 c=document.getElementsByTagName("input");
 for (var k=0; k<c.length; k++)
 {
 if (c[k].name.indexOf("Acknowledge")!=-1)
 {
 if (!c[k].checked)
 {
 alert("Please check the 'Acknowledge' checkbox to accept agreement.");
 return false;
 }
 break;
 }
 }
 return true;
}

You can also do this in Java code with a transition expression but that runs on server side after the button is clicked and you would trip a WTException with a helpful message.

 

19-Tanzanite
January 3, 2025

@avillanueva we are looking for tooltips

avillanueva
23-Emerald I
23-Emerald I
January 3, 2025