LCS - How to set a number or true/false value in a hidden field

There are times when the need will arise to pass an ID of another model that is not directly connected to a form field to the action of the form. Example: An application tracks projects and the associated tasks. On the detail page of the project a task can be created. In order to pass the ID of the Project to the create action of the Task a hidden field is used to hide the ID from the user. Out of the box this will not work as the hidden field will pass the ID as a text field not a number. Follow the process below to instead pass the ID as a number. This Should NOT be used to pass the "Current Logged in User" that is automatically available in the action and is dangerous to send it to an action from the form. 

Process:

  1. Drag and drop a hidden input component on to the page within the form.

    Selecting the hidden field component

  2. In the resulting dialog box deselect the "property based input" slider and in the Name field, name the variable something like "place_holder". This name does not matter so name it anything as you will be replacing it in a future step.

    Input variable name dialog box

  3. Next select the hidden input and delete the current "Action Input variable" by clicking the "x" button.

    arrow pointing to the deselect action variable

  4. Next Click "Select action variable". Then at the bottom of the drop-down menu is a + sign that will let you create a new action variable, click on that button.

    fly out menu with arrow pointing at the Add button

  5. Next in the resulting dialog box create a new variable name and select the type of variable needed (in this case, 'number') and click "Confirm".

    Select variable type and name dialog box

  6. Set the value to the property value needed to pass to the action (such as Project.id if the model was of type Project).

  7. The variable will now be available in the Action of the form in the format that was selected.

    list of action variables


Keywordspass an id   Doc ID132563
OwnerJoel H.GroupLow Code Solutions
Created2023-11-06 14:51:57Updated2024-02-01 09:29:44
SitesDoIT Enterprise Business Systems - Low Code Solutions
Feedback  0   0