Workflow and ServiceDesk Community

 View Only

Adding Placeholder Behavior to TextBox Elements 

Oct 01, 2015 06:17 PM

Original article is posted here.

Using placeholders in HTML forms is simple enough, but when building Workflow forms, the “placeholder” attribute is not made available to us in the designer.

Using a javascript body onload event, we have a very simple way to add placeholder functionality to a TextBox component in Workflow.

Symantec Workflow TextBox Placeholder Attributes
This illustration shows the results of adding placeholder attributes to textboxes in Workflow. Note: the popup labels featured in this example are not covered in this article.

 

First thing that needs to be done is to add values to the Control Ids of any TextBox that needs a placeholder value.
2014-10-27_14-48-44
Next, make sure that any “Initial Value” fields are cleared (unless these are being populated by existing variable data intentionally).  We don’t want to type any static values into the “Initial Value” field if we’re using this placeholder method.
2014-10-27_14-51-30
Next, add a Body Custom Event.  Select “onload”, and enter the following for the event handler code:

document.getElementById('TestTextBox').setAttribute("placeholder","Test Placeholder");
Symantec Workflow Body Onload Event
These steps illustrate configuring a body onload event to add a placeholder attribute to a textbox by id.

Workflow forms do not add the “placeholder” attribute to TextBox components by default.  Using this javascript method, we can easily add a placeholder to a TextBox.  The result:
2014-10-27_14-59-26

Thanks to jdeleon7010 for the question.

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Related Entries and Links

No Related Resource entered.