- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 11:52 AM
I have html code which have checkboxes when i check and save the incident the checkboxes that was selected before was unchecked. how to store that data like here i check test 1 and when i save the test1 is unchecked but i want to save the data.
html code:
<ul style="list-style-type: none;">
<li><input type="checkbox" />Test 1</li>
<li><input type="checkbox" />Test 2</li>
</ul>
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 12:44 AM
@Arjun Kumar Le1 it's not possible to achieve that.
Please mark as correct answer if this helped you.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 12:36 PM - edited 06-07-2023 12:38 PM
Hi @Arjun Kumar Le1 ,
If you are using widgets you need to use directives, in your HTML tried something like this:
<ul style="list-style-type: none;">
<li><input type="checkbox" ng-modal="c.test1" />Test 1</li>
<li><input type="checkbox" ng-modal="c.test2" />Test 2</li>
</ul>
<pre> The test 1 value is: {{c.test1}} and the test 2 value is: {{c.test2}} </pre>
In your client-script just define you c variable:
api.controller=function() {
/* widget controller */
var c = this;
c.test1 = false; // you dont need to add this but is a good practice
c.test2 = false; //you can change to true and in the load page would be checked
};
Hope that can help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 10:55 PM
This is not in portal, this is in back end form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 11:27 PM
@Arjun Kumar Le1 Its not possible. The html field will take static value. It will be dynamic.
If you want to achieve something like this then you need to add 2 new boolean fields (Test 1, Test 2).
Write onchange client script in both fields.
When "Test 1" field is changed and its true set below code in HTML field
<ul style="list-style-type: none;">
<li><input type="checkbox" checked="checked"/>Test 1</li>
<li><input type="checkbox" />Test 2</li>
</ul>
If "Test 2" field is changed and its true then
<ul style="list-style-type: none;">
<li><input type="checkbox" />Test 1</li>
<li><input type="checkbox" checked="checked" />Test 2</li>
</ul>
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2023 12:10 AM
there is no field related to this, these are only two html contents test1 and test 2 , after checke them save i need to save the at true check or false check, please guide me how to do this