Forums

Load an event with a button and remain on page

DrSmith69 01 Jun, 2020
Hi Guys,

I have a form which uses PHP calls to an API to pre-load forms and update on submit with new details,

What I want to do is without completing all of the fields and have a button which calls on my PHP to update the data and the reloads the form,

Currently I am using a multipage form and I need this to take place on page 2,

Page 1 you give an ID, it uses the ID to fetch the persons details, popuates the form on page 2, here I want to add a button to take the data in the fields and update them then reload the page 2 which basically re-fetches the data and pre-populates page 2, then you can complete the rest of page 2 and submit which finishes everything off.

Please can someone assist?
DrSmith69 01 Jun, 2020
So I have made a bit of progress, I changed the button type to a link, created a new event and added the PHP, the multi page and the display on there, it is working however, the PHP is not being run, almost as if the updated data is not stored as part of the multipage data, does multipage data variables only store as part of the submit action?
DrSmith69 01 Jun, 2020
I have added a debugger on my new link event and added a debugger on my working event, the link event is missing all of my fields in my array that is why nothing is updating, why would this be the case?
DrSmith69 01 Jun, 2020
New update - If i tick mix data with global data on the multipage form the debugger brings my array from page1 through but not the page I am currently on, only when I use the submit button action then the current page is part of the array
DrSmith69 01 Jun, 2020
Found where the issue lies now just need help finding a fix:

If I set the display section submit to my new event the debugger contains the correct array - meaning I have to click on Submit.

This is not what I need, I need to take the current completed fields, have an update button (looking at using a link pointing to the event containing the update PHP) and be able to click on that which calls on the event with the PHP looking at the current pages fields then refreshes the page (This part I have sorted so no need for assistance here)

Any help with this would be greatly appreciated
DrSmith69 01 Jun, 2020
Answer
1 Likes
AAAAND we have liftoff🙂

Removed the link and added a second submit button,

Set the name of both my submit buttons as the same and gave both a value, I then added an event switcher referenced {data:buttonname} set the two options to the values, then added my two sets of events under each one and we are a go.

So just to recap from what I can see submit buttons contain an action which capture the current pages data into an array, any other form of link etc does not so having two submit buttons is a MUST
healyhatman 01 Jun, 2020
Submit buttons SUBMIT the form. Links do not.
This topic is locked and no more replies can be posted.