How to Save and Reload UI Page Form Data in Read-Only Mode for Future Visits

bishalsharm
ServiceNow Employee
ServiceNow Employee

Hi Community,

I’m working on a UI Page for a change request form that contains multiple HTML elements such as:

  • TextArea

  • Label

  • Table

  • Checkbox

The use case is as follows:

  1. A user fills in the form and submits it.

  2. When the same user (or someone else) revisits the UI Page later, the previously submitted values should be automatically loaded and displayed.

  3. All form elements should appear in a read-only (non-editable) state on revisit if data already exists for that user.

How can I achieve this functionality ?

Any example or best practice guidance would be really helpful.

Thanks in advance!

 

-Bishal

7 REPLIES 7

@bishalsharm 

my response

-> I believe for retrieval you can run body onload function and see for the CHG if the data is already stored

-> Storing in CHG -> use GlideAjax call or GlideRecord in UI page client script to store data

-> making html element readonly - use html readonly attribute, for this you can check HTML W3 schools for other options.

I hope I have answered your question.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@Ankur Bawiskar ok let me work on it and will come back here for any queries till then i will keep this thread active.

@Ankur Bawiskar I am able to fetch the values from elements when they have ID using below code
var abc = gel('<sampleID>').value;
However, when I am doing the same thing for class it is not working. Do we separate methods for class elements ?