Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update snippet.formitretriever.php #89

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

Update snippet.formitretriever.php #89

wants to merge 1 commit into from

Conversation

bertoost
Copy link
Contributor

With this change it's possible to have &preHooks on FormItRetriever. This is useful when doing custom loading and keep the nice "redirectToOnNotFound" feature.

For example;
I want to use the submission form for editting again and I link back to the form with some URL parameters (to identify the item to edit). In my custom preHook I can catch that, gather the fields and populate FormIt dictionairy with that. Normally when I go back to the form with a "FormItRetriever" and &redirectToOnNotFound set, the FormIt store file is no longer there or not valid anymore (storeTime expired). With a custom snippet you can set values and this will make the request valid again.

With the if empty around the preHooks call it will make the submission values the most important and overrule the preHook stuff, that's perfect as far I can see.

With this change it's possible to have &preHooks on FormItRetriever. This is useful when doing custom loading and keep the nice "redirectToOnNotFound" feature.

For example;
I want to use the submission form for editting again and I link back to the form with some URL parameters (to identify the item to edit). In my custom preHook I can catch that, gather the fields and populate FormIt dictionairy with that. Normally when I go back to the form with a "FormItRetriever" and &redirectToOnNotFound set, the FormIt store file is no longer there or not valid anymore (storeTime expired). With a custom snippet you can set values and this will make the request valid again. 

With the if empty around the preHooks call it will make the submission values the most important and overrule the preHook stuff, that's perfect as far I can see.
@bertoost
Copy link
Contributor Author

Please also add

&& !$fi->request->hasSubmission()

To the new if() statement

SintezCode pushed a commit to SintezCode/FormIt that referenced this pull request Jul 10, 2019
Add fenom to chunk by pdoTools if available
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant