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

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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Susmitha,

Hope you are doing good.

Let me know if that answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

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

Ankur Bawiskar
Tera Patron
Tera Patron

Hope you are doing good.

Let me know if I have answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

 

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

Ankur Bawiskar
Tera Patron
Tera Patron

Hope you are doing good.

Let me know if I have answered your question.

If so, please mark appropriate response as correct & helpful so that this thread can be closed and others can be benefited by this.

Regards
Ankur

 

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