When necessary.
It depends. By default I would advise against them; not creating Form objects to receive and validate data that could be validated by the Model directly. Even when you have a few nested attributes that belong to the main model modified, I would advise against Form objects. Keep It Simple.
But… sometimes you have more complex forms that don't fit the database-mirroring ActiveRecord model as nicely.
The resolution of photo's increases every year. And while some of that information may be worthy of retaining, not all is. High resolution images come at a price. Not only storage, but, especially in a mobile context, also data transfer. In this post I explain how you could create an uploader that fixes this.
Traditionally your form would look something like this:
`
Upload image:
`
If you want to be forgiving to your end users (and not requiring them to manually resize the images themselves) you could configure your server to accept files > 20MB and resize the images server side.
However, to save bandwidth you you might want to resize the images just before uploading.
canvas
To manipulate pixels we need a canvas. So we need a canvas
element.
Note: Canvas support is barely an issue, but if things don’t work we’ll write to code as such that the traditional form submit will continue to work
...
Since we all seem to know that every other field in the registration form is another percentage of users failing to register*, we think of alternative ways to gather information. We gamify the user profile completeness by adding a progress bar to our user account, we present a full form after the confirmation link or we ask questions while using the application.
But there is another reason why we might not even ask all the questions. Ask the wrong questions and you may alienate your user.
It can be relatively minor things like picking your favourite colour, where the form just lets you pick one colour, while many have multiple. But it may also be more personal (or one could argue, more political): not everyone defines oneself as male or female, so why only present just these options (and do know that it isn’t particularly nice being referred to as ‘the other’ all of the time).
These issues are well discussed in this [talk by Ca…
Dit artikel van murblog van Maarten Brouwers (murb) is in licentie gegeven volgens een Creative Commons Naamsvermelding 3.0 Nederland licentie .