Quantcast
Channel: aras PLM community
Viewing all articles
Browse latest Browse all 1103

Get value from own dialog

$
0
0

Hi,

I have created an independent Form with html dropdown and I am calling this Form from an Action(item,client). HTML code  in the Form I used is:

<script>
function Ok()
{
    var doc = document.getElementById("select1");
    var targetItem =  doc.options[doc.selectedIndex].text;
    //alert(targetItem);

close();
}

function cancel(){
close();
}
</script>
<html>
<body>
<select id="select1">
        <option value="1">Item1</option>
        <option value="2" selected="selected">Item2</option>
        <option value="3">Item3</option>
</select>
    <br/><br><br>
    <button style="width:50px" onClick="Ok();">Ok</button> &nbsp;&nbsp;
    <button style="width:50px" onClick="cancel();">Cancel</button>
</body>
</html> 

And a method added to the Action to call this Form as dialog with code:

var formNd = top.aras.getItemByName("Form", "MyDialogTest", 0);
if (formNd)
{
  var param = new Object();
  param.title = "Select Item";
  param.formId = formNd.getAttribute("id");
  param.aras = top.aras;

  var width = top.aras.getItemProperty(formNd, "width");
  var height = top.aras.getItemProperty(formNd, "height");

 var _type = showModalDialog("ShowFormAsADialog.html", param,
          "dialogHeight:" + height + "px; dialogWidth:" + width + "px; " +
          "status:0; help:0; resizable:0; scroll:0;");
 }
//alert(_type);

if(_type == "Item1")
{
var _item_doc = inn.newItem("Document","add");
    var  result_doc = _item_doc.apply();
    top.aras.uiShowItem("Document", result_doc.getID(), 'tab view', true);
}
else if(_type=="Item2")
{
/// add & show ItemType2
}
else
{
///add & show ItemType3
}

 

Based on the value selected from the Dialog I should add and display an Item. But var _type is always returning 'undefined' .  How do I get the value selected in the form's dropdown.

Thank you.


Viewing all articles
Browse latest Browse all 1103

Trending Articles