How to make the textArea field mandatory in the UI Page?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2022 05:51 PM
Hello guys,
How to make the textArea field mandatory in the UI Page?
Thanks in advance,
Flavio
<g:ui_form>
<input id="clientData" name="clientData" value="${RP.getWindowProperties().get('clientData')}" type="hidden" />
<div class="row">
<div >
<span style="padding:16px;font-weight:bold;">What were you attempting to do when the performance issue occurred?</span>
</div>
</div>
<div class="row">
<div class="form-horizontal">
<div class="form-group" style="margin-left:16px !important;margin-right:16px !important">
<textarea id="comments" name="comments" class="form-control" spellcheck="true" style="overflow: hidden; word-wrap: break-word; resize: none;" ></textarea>
</div>
</div>
</div>
<div class="modal-footer">
<span class="pull-right">
<button class="btn btn-default" id="cancel_button" onclick="window.GlideModalForm.prototype.locate(this).destroy(); return false" style="min-width: 5em;" title="" type="submit">
Cancel
</button>
<button class="btn btn-primary" id="ok_button" onclick="actionOK()" style="min-width: 5em;" title="" type="submit">
Create Incident
</button>
</span>
</div>
</g:ui_form>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2022 06:00 PM
Hi Flavio,
Add the required attribute to the field. Example in below link.
https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_textarea_required
Thanks and regards,
Subrahmanyam Satti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2022 08:46 PM
Hello Flavio,
Please add this line instead of previous one.
<textarea id="comments" name="comments" class="form-control" spellcheck="true" style="overflow: hidden; word-wrap: break-word; resize: none;" required ="required"></textarea>
you can follow:https://community.servicenow.com/community?id=community_question&sys_id=3674d0f9db826b00b1b102d5ca961932
Please marked helpful and correct if it will help tp you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2022 09:30 PM
Hi,
this link has the solution
Make UI Page Text area mandatory
also this where I provided solution
How to make textarea and select box mandatory in UI page on click of a button in the same UI page?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-22-2022 09:32 PM
sharing the additional links as well
creating a mandatory field in ui page?
Make UI Page Text area mandatory
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader