Make UI Page Text area mandatory

Nitesh Balusu
Giga Guru

Hello,

I'd like to make this pop up box mandatory. What change needs to be made in the UI Page?

find_real_file.png

<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>
1 ACCEPTED SOLUTION

can you try now.

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
	
	<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;" required="required"></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>
</j:jelly>

View solution in original post

11 REPLIES 11

Alberto Consonn
ServiceNow Employee
ServiceNow Employee

Hi Nitesh,

here you will find the client script that will do that:

Set mandatory in UI page text area

Please try, if it will work, remember to reply also to the post above so that the other will know which is the right solution.

If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.

Thanks you

Cheers
Alberto

Harsh Vardhan
Giga Patron

are you sure you have sent correct UI Page code?

the ui page code you have sent is showing like below..

 

find_real_file.png

 

to make field mandatory on ui page define mandatory="true"

eg:

 <g:ui_reference name="${ref_table}_ref" id="${ref_table}_ref" table="${ref_table}" query="${query}" completer="AJAXTableCompleter" mandatory="true" aria-required="true"/>

 

kindly refer the below OOTB UI page as a reference.

https://yourInstanceid.service-now.com/sys_ui_page.do?sys_id=6a7128b28f1321001a83cfd827bdee22&syspar...

 

Oops sent the wrong one! I corrected it now, can you take a look?

can you try now.

 

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
	
	<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;" required="required"></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>
</j:jelly>