HelpSpot Help Desk Software | HelpSpot Blog | HelpSpot Support

Custom Field: pre-Filled Text


#1

How about an option to allow us to create text based on a Category selected? So if a user selects a certain category, it would give a text prompt. Currently, I’m using the “Checkbox” option and a long “Name” to give the information. But it would be nice to have the text look normal (not green like a header) and ditch the checkbox.


#2

Are you looking for this kind of functionality in the customer portal or in the admin interface?


#3

It would be an item we could ad as a custom field, that users would see on the portal when they select a certain category.


#4

I’ll add that as a feature request. But you can actually do it right now if you don’t mind editing your portal template and doing a little bit of javascript work. Here’s a bare-bones example. You could add a function to your request.tpl.php like this.

function showCustomMessage(){
var category = document.getElementById("xCategory");
var selectValue = category.options[category.selectedIndex].value;
  if(selectValue==1) {
    document.getElementById("customMessage1").style.display = "block";
  }
  else {
    document.getElementById("customMessage1").style.display = "none";
  }
}
</script>```

Then add a div where you would like the custom message to appear:
`<div id=customMessage1 style="display:none;">This is my custom message</div>`

Then finally, call that function in the on change action on the category selector
`<select name="xCategory" id="xCategory" onchange="ShowCategoryCustomFields(); showCustomMessage();">`