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

Flavio Tiezzi
Kilo Sage

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>
4 REPLIES 4

Subrahmanyam2
Giga Guru

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

Inactive_Us1238
Giga Expert

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.

Ankur Bawiskar
Tera Patron

sharing the additional links as well

creating a mandatory field in ui page?

Make UI Page Text area mandatory

Regards
Ankur