You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more of a usability issue but I thought it was worth mentioning since it has tripped me up twice writing forms at work using digestive-functors-snap. I figure if the lesson didn't stick in my head after the first time there may be a problem.
Right now it seems like digestive-functors-snap uses the request's HTTP method to distinguish between a form render (GET) and a form submission (POST). Semantically this is probably not the best idea. It is perfectly reasonable to submit a form with a GET request, such as if you're submitting a search form to a RESTful service. If the end user doesn't remember this, the form just returns a const Nothing essentially and both times I hit this issue I assumed it was a parse error.
One way to solve this is to not use the request method but instead use the presence of the expected parameters to determine if a form was submitted or not. I'm not sure if there are edge cases there that would make this ambiguous.
Even if we wanted to stick with manually telling the form whether it was being submitted or rendered, the way you do it is really confusing. You could be in a GET action and if you want to tell the form it is being submitted you have to do defaultSnapFormConfig { method = Just Post}. That solution eluded me twice because it doesn't make sense. You're not in a POST request. It would be much more self-documenting if you did something like defaultSnapFormConfig { mode = Just Submitted} or something like that.
Interested to hear your opinions on this. Thanks!
The text was updated successfully, but these errors were encountered:
If this form is run using the default runForm function, the initial state of the "is_core" field is checked. When run using a custom SnapFormConfig to force it to process on GET requests, the initial state of the "is_core" field is unchecked. I understand why this happens, but it is undesirable behavior.
This is more of a usability issue but I thought it was worth mentioning since it has tripped me up twice writing forms at work using digestive-functors-snap. I figure if the lesson didn't stick in my head after the first time there may be a problem.
Right now it seems like digestive-functors-snap uses the request's HTTP method to distinguish between a form render (GET) and a form submission (POST). Semantically this is probably not the best idea. It is perfectly reasonable to submit a form with a GET request, such as if you're submitting a search form to a RESTful service. If the end user doesn't remember this, the form just returns a const Nothing essentially and both times I hit this issue I assumed it was a parse error.
One way to solve this is to not use the request method but instead use the presence of the expected parameters to determine if a form was submitted or not. I'm not sure if there are edge cases there that would make this ambiguous.
Even if we wanted to stick with manually telling the form whether it was being submitted or rendered, the way you do it is really confusing. You could be in a GET action and if you want to tell the form it is being submitted you have to do
defaultSnapFormConfig { method = Just Post}
. That solution eluded me twice because it doesn't make sense. You're not in a POST request. It would be much more self-documenting if you did something likedefaultSnapFormConfig { mode = Just Submitted}
or something like that.Interested to hear your opinions on this. Thanks!
The text was updated successfully, but these errors were encountered: