Getting HTML field value into Processing Script Of UI Page

Susmitha14
Tera Contributor

I have created a UI page in that I have created an html field of type = "text", How can I access the Value of text field in Processing Script.

find_real_file.png

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Susmitha,

Are you still looking for solution to this?

If yes then below is the sample UI page which will show you the content coming inside the processing script

HTML:

<?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 type="hidden" id="contentvalue" name="contentvalue"/>
		<input type="hidden" name="cancel_or_submit" id="cancel_or_submit" value=""/>
		<textarea id="content" name="content" value=""/>
		<g:dialog_buttons_ok_cancel ok_text="${gs.getMessage('OK')}" ok="return actionOK();" cancel="return cancel();"/>
	</g:ui_form>
</j:jelly>

Client Script:

function actionOK() {
	gel('contentvalue').value = gel('content').value;
	return true;
}

function cancel() {
	var c = gel('cancel_or_submit');
	c.value = "cancel";
	return true;
}

Processing Script:

gs.info("Text Area Value is: " + contentvalue);

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

8 REPLIES 8

Ruhi Jibhyenka1
Mega Guru

Hi Sushmita,

Try below eg-

urformname.field=gel("field").value; should work.

Or check out below link-

https://community.servicenow.com/community?id=community_question&sys_id=b9e94729db5cdbc01dcaf3231f96...

Mark Correct if it solved your issue  and mark Helpful if you find my response worthy.

Thanks,

Ruhi

Hi Rubi,

I have tried but even information log is also not creating. Is there any mistake in the script?

find_real_file.png

Try using

gs.log("notification content" +content);

I tried with gs.log(), still the log is not working