UI page

newbiedeveloper
Giga Contributor

H All,

This is my Html code from ui page

How to show dropdown choices in a Html script in Ui page?

<g:ui_form>

<input type="hidden" id="cancelled" name="cancelled" value="false"/>

<input type="hidden" id="incidentSysID" name="incidentSysID" value="${sysparm_sysID}"/>

<table width="100%" cellpadding="0" cellspacing="0">

<g:ui_input_field name="name" id="server_name" label="Name"

                      value="${jvar_comments_text}" mandatory="true" />

        <g:ui_input_field name="ost" id="ost" label="OST"

                      value="Linux" mandatory="true" />                 // this one i want it to show dropdown choices 1 and 2. How to write this?

</table>

<table width="100%" cellpadding="0" cellspacing="0">

<tr><td align="left" nowrap="true"><br /><g:dialog_buttons_ok_cancel ok="return validateForm();" cancel="return onCancel();"/></td></tr>

</table>

</g:ui_form>

1 ACCEPTED SOLUTION

your <g:ui_input_field tag will actually render the following HTML:



<table>


  <tbody>


  <tr>


  <td id="label.server_name" type="string" choice="0" class="label" height="23px" nowrap="true">


  <label for="server_name" dir="ltr" class="   control-label" onclick="">


  <span id="status." mandatory="true" class="mandatory required-marker" oclass="mandatory"></span>


  <span class="label-text" data-html="false">Server Name</span>


  </label>


  </td>


  <td style=";" nowrap="true">


  <input autocorrect="off" size="" maxlength="" autocomplete="off" onkeyup="" name="server_name" onchange="onChange('server_name');" style="" id="server_name" type="text">


  </td>


  </tr>


  </tbody>


</table>




I'm not aware of a <g:> tag which will do the same for choice/dropdown lists, so unless anyone can point out a better way, I'd do the following:



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


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



  <!-- render a text field using a <g:ui_input_field> tag -->


  <g:ui_input_field name="server_name" id="server_name" label="Server Name" value="${jvar_comments_text}" mandatory="true" />



  <!-- the following is to render a choice list with the same label & spacing format as the above <g:ui_input_field -->


  <table>


            <tr>


                      <td id="label.os" type="string" choice="0" class="label" height="23px" nowrap="true">


                                <label for="os" dir="ltr" class="   control-label" onclick="">


                                          <span class="label-text" data-html="false">Operating System</span>


                                </label>


                      </td>


                      <td style=";" nowrap="true">


                                <select name="os" id="os">


                                          <option value="">--None--</option>


                                          <option value="Linux SuSE">Linux</option>


                                          <option value="AIX">AIX</option>


                                </select>


                      </td>


            </tr>


  </table>



</j:jelly>



which then looks like this...



Screenshot_5.png


View solution in original post

6 REPLIES 6

Hi Daniel



This was very helpful.


As I don't know your name, I was going to say "you're welcome newbie", but thought it might sound rude, so let's go with "you're welcome developer" !!



I hope you can help someone else with this info in future