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.
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.
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.
Next, add a Body Custom Event. Select “onload”, and enter the following for the event handler code:
document.getElementById('TestTextBox').setAttribute("placeholder","Test Placeholder");
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:
Thanks to jdeleon7010 for the question.