- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2019 02:27 PM
This seems like a simple question, but I've spent an hour researching it to no avail.
I have an Integer field (u_severity_num) on my form which displays across the entire width of the form. The field will only ever hold a 2-3 digit number, so I'd like the field to display much smaller/shorter, like 5-10 chars tops.
I've tried various methods:
I tried an onLoad Client Script with:
g_form.getControl('u_severity_num').style.width = '500px';
but that has no effect. I also tried:
var sd = g_form.getControl('u_severity_num');
sd.maxLength=20;
but that didn't affect the field size either.
I even tried putting it into a form section of it's own, with '2 column' selected for format, but it still displays across the whole form!
I then created a text field with a similar name, and tried both g_form methods above. They didn't work on the text field either.
I also tried modifying the Dictionary Entry for the text field, setting the Max Length to 10, but that didn't affect it.
How does one resize an Integer field (preferably), or as a fall-back, a Text field on a form?
Also, I see the 'g_form.getControl' method has been deprecated (for mobile), so a way to do it in both the form and portal interfaces is welcome, but I'll be satisfied with just the form interface working.
Thanks!
Solved! Go to Solution.
- Labels:
-
Now Mobile
-
User Experience and Design
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2019 09:58 AM
I broke down and submitted this to HI; their response (which works) is:
- Change the size/length of a field
- Right click on the field label in the form you want to change the size for and select 'Configure Styles'.
- Select 'New' to create a new style for that field.
- In the 'Style' section enter the code " width: 500px !important; " (without quotes). Set the width size according to your preference.
This worked, but only after I disabled the previously-failing Client Script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2019 02:37 PM
Did you check Isolate script checkbox on the Client script record?
https://community.servicenow.com/community?id=community_blog&sys_id=c5c46364dbba6b007d3e02d5ca9619cb
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2019 06:33 AM
The field had not been called out, but when I did, it was checked. I found that same article via the Google, but it doesn't fix my issue. Thanks anyway ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2019 07:00 AM
I found this.
https://hi.service-now.com/kb_view.do?sysparm_article=KB0547171
Please mark my response as correct and helpful if it helped solved your question.
-Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2019 09:58 AM
I broke down and submitted this to HI; their response (which works) is:
- Change the size/length of a field
- Right click on the field label in the form you want to change the size for and select 'Configure Styles'.
- Select 'New' to create a new style for that field.
- In the 'Style' section enter the code " width: 500px !important; " (without quotes). Set the width size according to your preference.
This worked, but only after I disabled the previously-failing Client Script.