This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Need to read Item Id value in HTML file opened by javascript Action method

sahana ks - Tuesday, September 6, 2016 2:10 AM:

I have created an  Action with Type='Item'. When I right click on the Item I want to read the item ID. I am able to read it in the action method say "showData()"(java script). In this java script method I am opening an HTML page. This html page has java script code i.e script section present in html file. I need to retrieve the value of item in this script section. Need suggestions on how to achieve this?

Note : I created a Form and opened that form in showData() method. Inside the form I have added an html element. this html code has javascript and CSS.

Appreciate help here.



edonahue - Monday, September 12, 2016 10:54 AM:

Hi Sahana,

Can you provide the method you're using to call the form, as well as the contents of the HTML field on the form, so I may review the current code?



sahana ks - Monday, September 12, 2016 11:50 AM:

Please find the javascript method and html element contents given here,

ShowData() method

var q = new Item("Form", "get");
q.setAttribute("select", "id");
q.setProperty("name", showDataFrm");
var r = q.apply();
if ( r.isError()||r.getItemCount()<1 ) {
top.aras.AlertError("Form not found.");
return false;
}

var selectedPartID = this.getProperty("id"); // I can read the part id here

var param = new Object();
param.title = "showDataFrm";
param.aras = top.aras;
param.isEditMode=true;

var res = showModalDialog("showData.html", param,"dialogHeight:800px; dialogWidth:900px; " +"status:0; help:0; resizable:1; scroll:0;");
return res;

--------------------------------

The custom Form "showDataFrm" has an html element in it. 

html contents are like,

---------------------------------------------

<head>

<script type="text/javascript">

// I need to rertrive the value of Part ID here.

</script>

</head>

<body> <div> ..............</div></body>

-----------------------------------------

// Note : I am not adding javscript in the showData.html file insetad adding it in the custom forms html element.

 I want to retrive the value of Part Id in the script section of html element above.

 



edonahue - Tuesday, September 27, 2016 5:57 PM:

Hi Sahana,

Typically you can access a context item from an HTML field on a form using:

document.thisItem.getProperty(<property name>,<default value>);    

If you have trouble accessing the context item via document.thisItem, you can also try passing the item id via the param object.