Trigger edit extra table entry

Hi

There is a trigger called "Edit extra table entry screen: Before button click". In this trigger you can grab the id of the extra table, id of table entry, and all the field the user has entered in the browser:

EventData ed = getEventData();
if (ed.getInputValue("extraTable.value").equals("6"))  //It is extra table 6
{
  if (ed.getInputValue("button").equals("ok"))  // User clicked ok
  {
    String val = ed.getInputValue("y_table_x_field.value");  // Grab the value of field x_field
    String newVal = val + "-hello";
    ed.setOutputValue("y_table_x_field.value", newVal);  // That one does not work
  }
}

However, setOutputValue does not seem to work.

Any ideas?

Marc

RE: Trigger edit extra table entry

Hi,

Yes, you are correct, we should support the setValues() there.

In the meantime, you can access the HtmlElement directly and manipulate it's value (or e.g. set an error value on it) like this:

HtmlElement desc = getHtmlElement("y_equipment_x_description");
desc.setValue("FOO: " + desc.toString());

Sverre

 

 

Av: Sverre Hjelm 16. mai 2019

RE: Trigger edit extra table entry

Hi Sverre,

this works fine for date and text fields. Thanks for the hint.

It does not seem to work for fields of type "User relation":

EventData ed = getEventData();
if (ed.getInputValue("extraTable.value").equals("6"))  //It is extra table 6
{
  if (ed.getInputValue("button").equals("ok"))  // User clicked ok
  {
    String val = ed.getInputValue("y_table_x_user.value");  // Grab the value of field x_user
    if (val.isEmpty() || val.equals("0") || val.equals("-1"))
    {
      // Set current user
      User user = getActiveUser();
      HtmlElement userElement = getHtmlElement("y_table_x_user");
      userElement.setValue(user.getValue("id"));
    }
  }
}

The field (y_table_x_user) remains empty.

Best regards

Marc

Av: Marc Eberhard 16. mai 2019

RE: Trigger edit extra table entry

Hi,

The names of the Html elements are not as consistent as they should be, due to historical reasons. You can investigate the names by calling getNumHtmlElements() and getHtmlElementName(). In this particular case, the name of the element is "y_table_x_name_tree".

Sverre

Av: Sverre Hjelm 22. mai 2019