Skip to main content
kavyan471063
Known Participant
August 25, 2023
Question

Local variable in button saveInto is not saving on one click.

  • August 25, 2023
  • 3 replies
  • 0 views

A cancel button has to save one rule input and one local variable value. If we click on the button once only the rule input changes but the local saving happens only after 2 nd click. If we remove the rule input then it is working. But we need both ri and lccal variable to save its respective values at the first click of button. PFA for the code snippet. Help me on the solution

a!buttonWidget(
              label: cons!PHSREC_BTN_LBL_CANCEL,
              style: "NORMAL",
              value: 3,
              saveInto: {
                local!currentPage,
                a!save(ri!buttonAction,cons!PHSREC_BUTTON_ACTION[6])
               
              },
              validate: false,
              showWhen: local!currentPage = 1              
            ),

    3 replies

    mikes0011
    Brainy
    August 25, 2023

    The saveInto parameter looks correct in general.  However I would note that you have the button set to disappear after it's clicked, since it's set to show up when local!currentPage has a value of "1" and clicking it should save a value of "3" to that variable.  You should probably simplify the on-form activity a bit and then understand what's happening, then re-add things one at a time making sure they're behaving as expected with each iteration.  Whatever your issue is though, it shouldn't be the saveInto configuration in particular that's causing it.

    The Expression Guru
    kavyan471063
    Known Participant
    August 25, 2023

    You are right. When the cancel button is clicked then a para field and a new Cancel request button should appear and the existed cancel button should disappear. On the first click the local variable is not saving as 3 but on the second click it changed to 3 as expected.

    mathieud0001
    Brainy
    August 25, 2023

    The saveInto works just fine, the button will dissapear as soon as it is clicked. I suspect that your issue is elsewhere in your code.