Skip to main content
February 6, 2021
Solved

Static Value in text field in saving in other variable

  • February 6, 2021
  • 8 replies
  • 0 views

Hi all,

I Need to display static value in the text field and same value should save into one more variable ,

Please advise.

load(
local!getTexfieldValue,

{
a!textField(
value: "abc",

saveInto:
{

a!save(local!getTexfieldValue,save!value)
},
),
a!textField(
value: local!getTexfieldValue,
)
}
)

Regards

Pallavi N

    Best answer by dhananjayk

    Yes that's right, you can save that way but this will work only if the user types in text field.

    If you are not sure if the user will do that then you can directly load the vale as Chandrasekar adviced as below:

    load(
    local!value: "Static Value",
    local!getTexfieldValue: local!value,
    a!textField(
    label: local!getTexfieldValue/* Added here to see the reflection, remove it*/,
    value: local!value,
    saveInto: {
    local!value,
    /* Below save into will save the new value of local!value if user interacts or change the value by tying into text field*/
    a!save(local!getTexfieldValue, save!value)
    }
    )
    )



    8 replies

    mikes0011
    Brainy
    February 7, 2021

    I'm not clear what you're trying to do here over all, but you should note that the saveInto for any field (regardless of what type of field it is) only executes upon user interaction.

    The Expression Guru
    February 7, 2021

    Hi Mike,

    can I get the static value of the text field with out refreshing the text field. I need to save that value to one more local variable so that i can use it to insert into Database.

    mikes0011
    Brainy
    February 8, 2021

    it looks like [mention:3c4e9f1e51754fa6b306f8ab4755b3e7:e9ed411860ed4f2ba0265705b8793d05] already gave you a working answer below, but just to clarify, "get static value of a text field" isn't really thinking about it in the right order.  A read-only text field just displays a value you feed in, it doesn't "have" a value to "get".  Any static values you want to have handy for use in other places on a form should be declared in a local variable, where they'll be accessible for whatever else you want (display, writing to DB, etc).

    The Expression Guru
    chandrasekharg0001
    February 7, 2021

    Hi Pallavi,

    Since that is a static value, can you initialize directly in local variables and use that according to your need in any subsequent form fields.

    February 7, 2021

    Hi Chandrasekar,

    I am expecting to save the value of this local!value into local!getTexfieldValue to inset this data to database,

    I am not displaying this value in interface but i need this value to be saved in local!getTexfieldValue .

    load(
    local!getTexfieldValue,
    local!value:"Static Value",


    a!textField(
    value:local!value,

    saveInto:
    {
    local!value,
    a!save(local!getTexfieldValue,save!value)
    },
    )

    )

    Please help me

    dhananjayk
    February 8, 2021

    Yes that's right, you can save that way but this will work only if the user types in text field.

    If you are not sure if the user will do that then you can directly load the vale as Chandrasekar adviced as below:

    load(
    local!value: "Static Value",
    local!getTexfieldValue: local!value,
    a!textField(
    label: local!getTexfieldValue/* Added here to see the reflection, remove it*/,
    value: local!value,
    saveInto: {
    local!value,
    /* Below save into will save the new value of local!value if user interacts or change the value by tying into text field*/
    a!save(local!getTexfieldValue, save!value)
    }
    )
    )