How to refresh a disabled text field so the value can be saved?

Hello, 

I have a text field who's value is linked to a dropdown field. If the dropdown value changes, the text field automatically changes as well. The text field is disabled as the user should not be able to change the value. The problem I have is that the value of this text field should be saved into a rule input but since I do not interact with the text field, the save into parameter does not trigger. I have no buttons on the interface so I could not add an a!save there. The user does not have to interact with any other field if they don't want so I couldn't put the a!save in another field as well. 

Is there a way for the text field to refresh without interacting with it to trigger the save into? 

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    No field can "save a value" if the user doesn't interact with it.

    In your case, you want the value to be saved after the action on the dropdown field, and the text field can merely display that saved value.  This is the correct, and only, option.

  • Thank you Mike, the problem I have is that if I put the a!save in the dropdown field it stores the previous value of the variable because the variable updates its value after the a!save stores it. Is there a way to have that order reverse?

  • 0
    Certified Lead Developer
    in reply to gabrield295009
    I put the a!save in the dropdown field it stores the previous value of the variable because the variable updates its value after the a!save stores it.

    a!save() statements execute sequentially in the order you put them.  that almost always works for cases like this.  as stefan mentioned, please share your dropdown code (and i guess also share what your text field is currently doing).

  • a!textField(
                            label: "Tipo de Producción",
                            value: if(a!isNotNullOrEmpty(ri!campos.grupo_subgrupo), rule!MAQMYD_LI_DESCRIPCIONTECNOLOGIAPORID(tecnologiaId: local!tipoProduccion), ri!solicitud['recordType!{01193449-852c-4fc3-8db1-52013ec60818}MYD_CU_RT_Solicitud_MYD.relationships.{ae59e3dd-aaff-476c-902d-1b44ede61381}mydCuRtSolicitudModificacionCil.relationships.{1fd245dd-6978-412d-a378-82b9fba52429}mydCuRtDetalleCilV2.relationships.{396bc71a-41cf-44fa-9b02-cb43e53f1595}mydCuRtTecnologiaPrimaria.fields.{84cbf7c3-9b05-4425-b967-5ddd3e4675cb}desTecnologiaPrimaria']),
                            disabled: true(),
                            saveInto: if(a!isNotNullOrEmpty(ri!campos.grupo_subgrupo), rule!MAQMYD_LI_DESCRIPCIONTECNOLOGIAPORID(tecnologiaId: local!tipoProduccion), ri!solicitud['recordType!{01193449-852c-4fc3-8db1-52013ec60818}MYD_CU_RT_Solicitud_MYD.relationships.{ae59e3dd-aaff-476c-902d-1b44ede61381}mydCuRtSolicitudModificacionCil.relationships.{1fd245dd-6978-412d-a378-82b9fba52429}mydCuRtDetalleCilV2.relationships.{396bc71a-41cf-44fa-9b02-cb43e53f1595}mydCuRtTecnologiaPrimaria.fields.{84cbf7c3-9b05-4425-b967-5ddd3e4675cb}desTecnologiaPrimaria']),
                            readOnly: ri!soloLectura,
                          )   
    
    a!dropdownField(
                          choiceLabels: cons!MAQMYD_CONS_SUBGRUPOSNORMATIVOSPERMITIDOSCIL,
                          choiceValues: cons!MAQMYD_CONS_SUBGRUPOSNORMATIVOSPERMITIDOSCIL,
                          label: "Grupo/subgrupo",
                          labelPosition: "ABOVE",                                          
                          placeholder: "--- Seleccionar grupo/subgrupo ---",
                          value: if(a!isNullOrEmpty(ri!campos.grupo_subgrupo),ri!solicitud['recordType!{01193449-852c-4fc3-8db1-52013ec60818}MYD_CU_RT_Solicitud_MYD.relationships.{ae59e3dd-aaff-476c-902d-1b44ede61381}mydCuRtSolicitudModificacionCil.relationships.{1fd245dd-6978-412d-a378-82b9fba52429}mydCuRtDetalleCilV2.relationships.{396bc71a-41cf-44fa-9b02-cb43e53f1595}mydCuRtTecnologiaPrimaria.fields.{14139e4f-e991-448b-9f3f-6836130e14b7}grupoNormativo'],ri!campos.grupo_subgrupo),
                          saveInto: {
                            
                            a!save(ri!campos.grupo_subgrupo,save!value), 
                            a!save(
                              target: ri!campos.tipo_produccion,
                              value: local!tipoProduccion,
                            )
                            },
                          searchDisplay: "AUTO",
                          disabled: ri!soloLectura,
                          )
                          
                          
                          

  • Thank you Mike and Stefan, I have shared the code

Reply Children
  • 0
    Certified Lead Developer
    in reply to gabrield295009

    A simple standalone example.

    a!localVariables(
      local!textFieldValue,
      local!dropdownFieldValue,
      {
        a!textField(
          label: "Text",
          labelPosition: "ABOVE",
          disabled: true,
          value: local!textFieldValue
        ),
        a!dropdownField(
          choiceLabels: {"Option 1", "Option 2", "Option 3", "Option 4",
                          "Option 5", "Option 6", "Option 7", "Option 8",
                          "Option 9", "Option 10", "Option 11", "Option 12"},
          choiceValues: {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12},
          label: "Dropdown",
          labelPosition: "ABOVE",
          placeholder: "--- Select a Value ---",
          value: local!dropdownFieldValue,
          saveInto: {
            local!dropdownFieldValue,
            local!textFieldValue
          },
          searchDisplay: "AUTO",
          validations: {}
        )
      }
    )

    It is really hard to follow the logic in your interface ...