Nov 7th, 2009, 11:12 AM
Terrific idea. I can certainly see how this could be helpful.
A little information first. Form integration via the API is handled via sessions (database or PHP). When the user first arrives at the form, it reserves a unique record ID for the form, then keeps track of info as the user progresses through the form. On the final page it submits the content for that unique ID and empties sessions.
So at that point, all data is emptied. If they return to the form at that point, a new submission ID is reserved and they start anew. The trick will be to circumvent this and tell it to remember certain field values.
One hack solution would be to do this: on the final page, right before emptying sessions, store the fields you want in a temporary array. Then empty sessions (ft_api_clear_form_sessions()). Then, store the fields back in the $_SESSION var. Finally, on the first page of your form, after the ft_api_init_form_page() call, check the return value to see if $fields contains empty values for some of the form fields (e.g. the required ones). If it's empty, stick the values from $_SESSION back into that var.
Hack? Yup.
I'll put this down as a feature request. It would nice to have this as a built-in option.
- Ben
A little information first. Form integration via the API is handled via sessions (database or PHP). When the user first arrives at the form, it reserves a unique record ID for the form, then keeps track of info as the user progresses through the form. On the final page it submits the content for that unique ID and empties sessions.
So at that point, all data is emptied. If they return to the form at that point, a new submission ID is reserved and they start anew. The trick will be to circumvent this and tell it to remember certain field values.
One hack solution would be to do this: on the final page, right before emptying sessions, store the fields you want in a temporary array. Then empty sessions (ft_api_clear_form_sessions()). Then, store the fields back in the $_SESSION var. Finally, on the first page of your form, after the ft_api_init_form_page() call, check the return value to see if $fields contains empty values for some of the form fields (e.g. the required ones). If it's empty, stick the values from $_SESSION back into that var.
Hack? Yup.
I'll put this down as a feature request. It would nice to have this as a built-in option.
- Ben