Skip to Content
Jun 14, 2020 at 12:29 AM

XSJS oSimpleForm Drop down with values in insert form

97 Views Last edit Jun 14, 2020 at 03:22 AM 3 rev

I have insert form where end user can type in value and submit. I need to add drop down for couple of fields where user will have to select from drop down value.

As of now this is the code to add value but need a drop down to give option for YES or NO

function openCreateDialog(){ 
                var oCreateDialog = new sap.ui.commons.Dialog();
                oCreateDialog.setTitle("Insert New User Data");
                var oSimpleForm = new sap.ui.layout.form.SimpleForm({
                    maxContainerCols: 2,
                        new sap.ui.core.Title({text:"Users"}),
                        new sap.ui.commons.Label({text:"Id"}),
                        new sap.ui.commons.TextField({value:""}),
                        new sap.ui.commons.Label({text:"FLAG"}),
                        //dropdown for the FLAG (YES / NO)
                        new sap.ui.commons.TextField({value:''})

I found how it works here normally but cannot emulate the same in my code

If it was a simple html file I could have used following code with some modification

<!DOCTYPE html>
<h1>Flag </h1>
<label for="flag"> Choose Flag</label>
<select id="flag">
  <option value="YES">Yes</option>
  <option value="NO">No</option>

Please guide / help me since I am using UI5 template theme="sap_belize", not able to translate aforesaid html code UI5 code..

Thanking in advance