Capture radio button value from a UI page

pss_rets
Kilo Explorer

I'm currently building a request form in Dev. The problem is, sometimes forms have tons of rows of checkboxes, like this:

pmg.jpg

 

Usually if there is a few rows, I will use select boxes where the user can choose "Add" or "Remove". But if there's plenty of rows, this process would be very slow.

 

I have considered writing HTML code in a macro that will display a large table with radio buttons.

 

pmgv1.jpg

 

However when I tried doing this, after submitting the request and opening the description of the request, the radio buttons I check are never saved.   They all go back to their default value (which in the above picture would be all the radio buttons in the "no action" column being checked)

 

In your opinion, what would be the best way to implement tons of rows of checkboxes/radio buttons?

 

Below is a shortened code on what I am trying to build:

 

<?xml version="1.0" encoding="utf-8" ?>

<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">

<tr>

<td>

 

 

<table width="100%" id="tbl_1">

                <tr>

                        <td style="padding-left:10px">Generic Account (No Admin Rights)</td>

                        <td style="padding-left:1px"><input type="checkbox" name="no_admin_rights" value="no_admin_rights" /></td>

              </tr>

</table>

</td>

</tr>

 

 

<tr>

<td>

    <table border="1" width="100%" id="tbl_1">

              <tr>

                      <th style="padding:5px 150px">Windows Group</th>

                      <th style="padding:5px 30px">Add</th>

                      <th style="padding:5px 30px">Remove</th>

                      <th style="padding:5px 30px">No Action</th>

              </tr>

              <tr>

                        <td style="padding-left:10px">Administrators</td>

                        <td align='center'><input type="radio" name="Administrators_awindowsgroup" value="AdministratorsAdd" /></td>

                        <td align='center'><input type="radio" name="Administrators_awindowsgroup" value="AdministratorsRemove" /></td>

                        <td align='center'><input type="radio" name="Administrators_awindowsgroup" value="-" checked="checked" /></td>

              </tr>

 

 

              <tr>

                        <td style="padding-left:10px">Domain Admins</td>

                        <td align='center'><input type="radio" name="Domain Admins_awindowsgroup" value="Domain AdminsAdd" /></td>

                        <td align='center'><input type="radio" name="Domain Admins_awindowsgroup" value="Domain AdminsRemove" /></td>

                        <td align='center'><input type="radio" name="Domain Admins_awindowsgroup" value="-" checked="checked" /></td>

              </tr>

 

 

              <tr>

                        <td style="padding-left:10px">SCI-Child Domain Administrators</td>

                        <td align='center'><input type="radio" name="SCI-Child Domain Administrators_awindowsgroup" value="SCI-Child Domain AdministratorsAdd" /></td>

                        <td align='center'><input type="radio" name="SCI-Child Domain Administrators_awindowsgroup" value="SCI-Child Domain AdministratorsRemove" /></td>

                        <td align='center'><input type="radio" name="SCI-Child Domain Administrators_awindowsgroup" value="-" checked="checked" /></td>

              </tr>

 

      </table>

</td>

</tr>

</j:jelly>

1 REPLY 1

adiddigi
Tera Guru

Basically, the reason why they return back to their original state once the requested item is created as UI Pages/Macros don't as of today store the "state" of their HTML elements.



There are many ways to handle the situation. One of them is :



1. Write an onSubmit script on Service Catalog page, and store the values of CheckBox ids and their values, in preferably JSON format.



2. Set this JSON in any hidden Service Now variable.



3. Write a Client Script on Requested item retrieving the value from the variable and then sending it to a function in UI page/macro that sets the id with it's respective value.