themosis / framework

The Themosis framework core.
https://framework.themosis.com/
GNU General Public License v2.0
671 stars 121 forks source link

Added the option to return value if a form failed #878

Closed Juje closed 1 year ago

Juje commented 1 year ago

Added the setValidatorReturnValueOnFail() method to the Forms\Form class so that it can manipulate what should happen if a form validation fails.

In other words a developer can call $form->setValidatorReturnValueOnFail() to make sure that data failed data will be put back into the form element.

optio commented 1 year ago

+1

Juje commented 1 year ago

@jlambe Any update when this can be merged?

jlambe commented 1 year ago

@Juje Sorry, it went off my radar... but can you add tests for this feature before I can merge ?

Juje commented 1 year ago

@Juje Sorry, it went off my radar... but can you add tests for this feature before I can merge ?

Sure no problem

Juje commented 1 year ago

@jlambe I've added 2 tests for both flows. I hope it suffices if not let me know and I'll happily edit it :slightly_smiling_face:.

Juje commented 1 year ago

The option API actually makes a bit more sense in this case so I've updated everything and the test passes :slightly_smiling_face:.

jlambe commented 1 year ago

@Juje I just saw the PR was on the main branch. In the future if you have new code requests, target the 3.0 branch instead 😃

Juje commented 1 year ago

@Juje I just saw the PR was on the main branch. In the future if you have new code requests, target the 3.0 branch instead smiley

Thanks for accepting the PR :slightly_smiling_face: .

But uhm you told me to merge it against main :wink: https://github.com/themosis/framework/issues/874#issuecomment-1289259191

jlambe commented 1 year ago

🤦‍♂️ oups 😂

Juje commented 1 year ago

But, I updated composer and the change works perfectly with our code on staging :slightly_smiling_face:.