# Unable to pass hidden field from Action to Form

**URL:** <https://community.auth0.com/t/unable-to-pass-hidden-field-from-action-to-form/135651>\
**Category:** Get Help\
**Tags:** other, missing-category\
**Created:** [June 4, 2024, 8:43pm UTC](https://community.auth0.com/t/unable-to-pass-hidden-field-from-action-to-form/135651 "2024-06-04T20:43:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![devans](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@devans](https://community.auth0.com/u/devans)\
**Post date:** [June 4, 2024, 8:43pm UTC](https://community.auth0.com/t/unable-to-pass-hidden-field-from-action-to-form/135651/1 "2024-06-04T20:43:41Z")

</div>

I’m trying to pass a hidden field from an Action to a new Form I’m building via this code:

```auto
exports.onExecutePostLogin = async (event, api) => {
  api.prompt.render('ap_1REWW3UztkwjxdGPbqsCya', {
    fields: {
      update_profile: "true",
    }
  });
}

```

However, when I reference the hidden field named update\_profile, the form seems to break. Am I doing this incorrectly? Any additional information on how to pass variables from an Action to a Form would be greatly appreciated.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/1/f/1f3619a2f92d16d8ab44d8df7d81fbf46d19d2c3.png)

Router setting I’m trying to use (which always just gets the default):

 ![image](https://global.discourse-cdn.com/auth0/original/3X/b/d/bd48611364b7015bca4acf59879ce0d19c8605d8.png)

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [June 5, 2024, 8:05pm UTC](https://community.auth0.com/t/unable-to-pass-hidden-field-from-action-to-form/135651/3 "2024-06-05T20:05:00Z")

</div>

Hi @devans,

I have tested this on my end and was able to get it to work successfully without issues.

The first thing you might want to include in your Post Login action script is the `onContinuePostLogin` function, which allows the form to resume the authentication flow.

```auto
exports.onExecutePostLogin = async (event, api) => {
  api.prompt.render('ap_1REWW3UztkwjxdGPbqsCya', {
    fields: {
      update_profile: "true",
    }
  });
}

exports.onContinuePostLogin = async (event, api) => {
  // (Optional) Add your logic after completing the form
}

```

Next, if your form seems to break, please ensure that your router connects a path for all conditions, including the default case. See the example below:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/2/1/21ecc903c1321f197eb3d0f6b2891dfab8e0749a.png)

Once that’s complete, the forms will render correctly.

Let me know how this goes for you.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![devans](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@devans](https://community.auth0.com/u/devans)\
**Post date:** [June 5, 2024, 8:52pm UTC](https://community.auth0.com/t/unable-to-pass-hidden-field-from-action-to-form/135651/4 "2024-06-05T20:52:19Z")

</div>

Hi @rueben.tiow !

Thank you for taking the time to replicate this flow on your end. I still seem to be having the same issue where the value doesn’t change the flow when the router is defined?

Here are some more screenshots which should outline everything I’m doing. Basically I just want to have the variable update\_profile be passed from the Action to the form flow:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/a/1/a1de66ccdb7571253dcdb1d0934a8778e86a54b9.png)

 ![image](https://global.discourse-cdn.com/auth0/original/3X/0/f/0f83e263d4bb6b72982a1e2ab753f0974d5ccb72.png)

 ![image](https://global.discourse-cdn.com/auth0/original/3X/c/2/c2f6d60523faf5f715e7f388e21c170057a5c4ed.png)

 ![image](https://global.discourse-cdn.com/auth0/original/3X/1/d/1d9364157d4d0fce9db06c236ede4d1996f3a76e.png)

Do I need to add anything else for this logic to work? The code as is always goes into the default case when I want to determine the flow within the Action via the update\_profile.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [June 6, 2024, 7:08pm UTC](https://community.auth0.com/t/unable-to-pass-hidden-field-from-action-to-form/135651/5 "2024-06-06T19:08:06Z")

</div>

Hi @devans,

Can you share a screenshot of the configuration for your _Step_ as well?

 ![image](https://global.discourse-cdn.com/auth0/original/3X/e/e/eee4b1964cb2c2baa01cb9670fee083d91e37492.jpeg)

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![devans](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@devans](https://community.auth0.com/u/devans)\
**Post date:** [June 6, 2024, 7:25pm UTC](https://community.auth0.com/t/unable-to-pass-hidden-field-from-action-to-form/135651/6 "2024-06-06T19:25:18Z")

</div>

Hey @rueben.tiow,

Here’s a screenshot of the Step which is basically just a test that doesn’t do anything:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/5/3/535bebb236484a53bdced7ec1a46dc1061933068.png)

I was just using that to test the variable being used that I’m trying to pass from the Action itself.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [June 12, 2024, 12:51am UTC](https://community.auth0.com/t/unable-to-pass-hidden-field-from-action-to-form/135651/7 "2024-06-12T00:51:40Z")

</div>

Hi @devans,

Thanks for sharing the screenshot.

I have identified the issue. Essentially, your Post Login action script does not reference the correct ID. It should reference the ID you defined in your Step settings, ’ test\_input\_id`.

So, in your Post-Login action script, it should be:

```auto
exports.onExecutePostLogin = async (event, api) => {
  var app_id = "YOUR_APP_ID"
  api.prompt.render(app_id, {
    fields: {
      update_profile: "true"
      test_input_id: "Any text you want here"
    }
  });
};

```

When done this way, it will populate the fields correctly.

Could you try this and let me know how it goes?

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![devans](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@devans](https://community.auth0.com/u/devans)\
**Post date:** [June 12, 2024, 1:16pm UTC](https://community.auth0.com/t/unable-to-pass-hidden-field-from-action-to-form/135651/8 "2024-06-12T13:16:21Z")

</div>

Hi @rueben.tiow,

The step I included was just to test the flow of the form itself. What I was trying to accomplish was to route the user using the Router based on a value (update\_profile) which should be set in the action itself. I.e. if the value of update\_profile is true (passed from the Action), I want the user to update their profile. If it’s false (default case) I want to just sign them in. Is that possible?

Hopefully that makes sense. I’m trying to use the value passed from the Action to do the initial Router logic before the user is taken to any form.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/1/3/136ac14f3dbd0811e3d5a42d006cc7252913c071.png)

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [June 29, 2024, 12:32am UTC](https://community.auth0.com/t/unable-to-pass-hidden-field-from-action-to-form/135651/9 "2024-06-29T00:32:36Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
