Forum Discussion

AngelaIp's avatar
AngelaIp
Ideator I
2 years ago
Solved

How to update form field from CUI button in item window command bar?

Hi community,

has anyone of you ever updated a Form field from a CUI button event from the ItemView.ItemCommandBar (=the main toolbar with the Edit/Done/etc. button when a Form is opened)? 

I am right now look for some code sample for this use case, but haven´t found the right one yet.

I want to move some regular buttons from the Form to the ItemCommandBar cause it better fits the use case. 

With regular Form buttons updating Form fields is pretty easy. We can use window.handleItemChange("xyz","newValue") to update the fields.
But we cannot use the same function from a CUI button in the ItemCommandBar.

Does anyone already have a sample Method for this one?

Thanks for any help!

Angela

Edit: thisItem.setProperty("xyz","123"); updates the context item, but it doesn´t do a live update in the Form field. So with the one the new value only appears after the user clicked save. I want to live update the Form with CUI, just like it would do with handleItemChange

  • Maybe window.findInstanceFrame().handleItemChange(...)?

3 Replies

  • Maybe window.findInstanceFrame().handleItemChange(...)?

    • AngelaIp's avatar
      AngelaIp
      Ideator I

      Hi Alaxala,

      many thanks for this solution! It works like a charm!

      I am always surprised where you discover these kind of solutions. I was able to find the findInstanceFrame function in the codetree, but my Innovator doesn´t seem to use the function anywhere at all. I am happy and confused by this one at the same time.[emoticon:c28b2e4cc20f4ba28d1befdba6bed29c]

      Angela

      • alaxala's avatar
        alaxala
        Ideator I

        For my part, thanks for handleItemChange function. I did not know about it and had to use an ugly

        aras.setItemProperty(...);
        window.getFieldByName(...).getElementsByTagName("input")[0].value = newValue;