saveInto does not store my default value

Hello Everyone!

I have a Record with Shops, and then also a Record with products.

In my Shops grid I have an actions that  allows me to add a Product to that specific Shop.

I should have the Shop ID as a read only, since it doenst have to be changed, We should be able to fill in only the rest of the fields with the product details.

When I do that, it doesn't store the Shop ID into my product information.

it only stores the value if it's not a read only field AND if i edit the value.
So fore example if I keep the ID as 17, it doesn't work, but iI type one more number and turn it into 171, it stores it.

As u can see in the picture, the rest of the fields get saved, so that confuses me even more:


Any idea why this happends and how could I solve it?

This is how my interface looks like:

Thank you so much for your time!

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Save into will not work on read only fields, value will not be saved if the user does not interact with the SAIL component.

    There is another solution. Specify the default value in local variable in load. Then save that variable in rule input in the buttonLayout. So that when the user submits the form by clicking on "Submit" button, the value will get saved into the rule input automatically. In this case, the user need not interact with the text field. Your code will be like this:

    load(
    local!tv: "testValue",
    a!formLayout(

    firstColumnContents: {

    a!textField(
    label: "label",
    value: local!tv,
    readOnly: true(),
    saveInto: local!tv
    )
    },

    buttons: {
    a!buttonLayout(
    primaryButtons: a!buttonWidgetSubmit(
    label: "Submit",
    saveInto: a!save(ri!tv, local!tv)
    )
    )
    }

    )
    )

Reply Children
No Data