- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2016 03:02 PM
Hi, I'm creating a form in a UI Page and want to pre-populate some fields from sys_user. The issue I run into is this error message: "The value of attribute "value" associated with an element type "input" must not contain the '<' character."
I've used the following script to pull the first_name field from sys_user:
<script>
<g:evaluate var="jvar_user_name">
var gr = new GlideRecord('sys_user');
gr.get('sys_id', gs.getUserID());
gr.first_name.getHTMLValue();
</g:evaluate>
</script>
Here's my HTML:
<table>
<tr>
<td><input type="text" id="first_name" name ="firstname" value="<g:no_escape>${jvar_user_name}</g:no_escape>"></input></td>
</tr>
</table>
Is there an alternate syntax to do this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2016 04:20 PM
Why are you attempting to add "<g:no_escape>" within the value?
Remove that tag, as there should be no need for that for anything you put into a text field.
If you absolutely need to add XML/HTML, consider using the innerHTML instead of value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2016 04:25 PM
Just wondering what are you trying to achieve by putting HTML content into the input value?
If it's just value, can it be done without the HTML?
<script>
<g:evaluate var="jvar_user_name">
var gr = new GlideRecord('sys_user');
gr.get('sys_id', gs.getUserID());
gr.first_name;
</g:evaluate>
</script>
Here's my HTML:
<table>
<tr>
<td><input type="text" id="first_name" name ="firstname" value="${jvar_user_name}"></input></td>
</tr>
</table>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2016 05:32 PM
HI Nam, you're correct, if I take out getHTMLValue I still get the field values, however it loses all of its formatting. For example, without getHTMLValue for phone number returns +12025555555, but if getHTMLValue remains, then phone number returns as +1(202) 555-5555.
Thanks.