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

How to edit values of form fields using a button event

$
0
0

Hi,

I'm trying to edit the values of item fields from a button event. Values are being updated but I can't see the updated values on form field directly unless I lock it / save it. 

Here is what I'm doing:

From button event on item's form: 

var thisItem = document.thisItem;
    var thisId = thisItem.getProperty("id");
    var formNd = top.aras.getItemByName("Form", "NewEntriesForClass", 0);
        if (formNd)
         {
           var param = new Object();
           param.title = "Update Class";
           param.formId = formNd.getAttribute("id");
           param.itemId = thisId;
           param.aras = top.aras;
           var width = top.aras.getItemProperty(formNd, "width");
           var height = top.aras.getItemProperty(formNd, "height");
            var options = {
                 dialogWidth: width,
                 dialogHeight: height
              };
 var wnd = top.aras.getMainWindow();
              wnd = wnd === top ? wnd.main : top;
          top.aras.modalDialogHelper.show('DefaultPopup', wnd, param, options, 'ShowFormAsADialog.html');        }

Created an independent form 'NewEntriesForClass' which will be shown as popup with checkboxes and a 'OK' button.

From the 'OK' button of popup: 

var inn = new Innovator();
var thisItem = document.thisItem;

var wnd = top.aras.getMainWindow();
wnd = wnd === top ? wnd.main : top;

var itemId = wnd.dialogArguments.itemId;
var chkCount = 0;
for (var i=0; i<_input.length; i++) {
     if (_input[i].type == 'checkbox') {
         chkCount++;
     }
}

var ChekArray = [];
 for(var k=0;k<chkCount;k++)
  {
var chkIdK = "id"+k;
if(document.getElementById(chkIdK).checked)
 {
ChekArray.push(document.getElementById(chkIdK).value);
 }
  }
   var partItem = inn.getItemById("Part",itemId);
  if(partItem.getItemCount()===1)
  {
   partItem.setAction("edit");
   partItem.setProperty("allowable_classes",ChekArray.toString());
   partItem = partItem.apply();
   }

parent.args.dialog.close();

The new value is set to part but not getting refreshed on opened form. How to refresh the part item or update the value in field directly without using Lock/Save again.

Please help me.

Thank you, Vardh.


Viewing all articles
Browse latest Browse all 1103

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>