Session manager object associated data from form inputs and hide and show on click

Here is the situation,

I have created a calculator with inputs. the first two inputs need to be placed an on the click of the submit button they need to hide the first segment and show the second segment. However I need to send this over as a JSON object. To do this I have created an object in the session manager that will store the values entered. How I approached this is the following.

I created the session object

then I created the button action
Screen Shot 2023-02-07 at 10.11.53 PM

and

and so on… The issue is that when clicking the button it does not hide and show the next form.

I created the following hide and show;
Screen Shot 2023-02-07 at 10.14.27 PM

and here is the code;

I have been able to hit the API and it is successful but it has to be received as an Object with the content within it. I am getting really frustrated with Wappler because I am sure it is something simple and I see solutions on stack overflow that state that I need to place something like the following;

    headers: {
    "content-type": "application/json",
    },
json: requestData

into the API request when pulling the session object.

Man I hope someone can shed some light to this, and again I am very sorry to bother the community.

all the best!

How do you submit the data? Is it using the API Form component on the front end?
If yes, then setting the post type in its properties to JSON will add Content-Type: application/json to the request headers …

hey @Teodor,

I was using the API form but even selecting JSON would not allow for a single JSON Object to be sent. What my team is looking for is to receive the data as a JSON blob of the form data. As of right now I am receiving a 422 error.

My thought is to store the info in # session objects, then have the API action attached to the buttom grab the info from each session object and place the info in a variable and then send it to the API as a blob. I think I am explaining this correctly…

The problem is with having a single session object where the info is stored, I cant show and hide the forms upon completion. Let me make a quick video so you can see what I have done.

Again thanks for your help as always.

@Teodor @patrick

So I tried many things, I created an session object and inserted 4 number variables in it. But when I do that it auto populates the set session with all 4 variable and not just the ones I need to populate at the time of click.

I am now setting this up as follows;

4 individual variables that are numbers in the session manager
1 object variable named for the API

the form will store each value in its corresponding session # variable;
for example;

session # variable Named NumberIndividualsInHousehold when the submit button is clicked will store that value and can be called

There are a total for 4 variables for now

The single object variable named carbonData will be pushed all for # variables into the value of this variable. Dont ask me why, but my backend group is being very stubborn and are saying it needs to be as a blob not as content in the header. @Teodor, I placed the form into an API form and I received a 202 message but the API is not seeing the data coming across.

see the video of the issue when I try to select the value from the form input when trying to session on click.

Guys I am getting really frustrated here as I know I am close but the forces are just not aligning to get it done right.

Thanks for any help you can give!

A 202 message sound good, it means the content was accepted. I still don’t understand exactly what you are sending and what the session is for, do you want to send the values from the form or the object stored in the session?

yah the message was a good thing, however the information was not accepted. It was as if the system said you passed the test to get in but we don’t want the info because it is not given to us in the way we like to see it.

what i need is for the session object to be passed. But the trick is I need the session object to allow for the hide and show of the form elements as they are completed.

I created in one test an session object with four child variables that were numbers. However when setting session hide and show events, all child events of the parent session object were attached automatically when I selected the specific childs to be used as the show hide actions.

let me know if you need a video or images for further clarification.

Thanks for the help @patrick