[Kimchi-devel] [PATCH] Enable buttons only when all required data is entered

Crístian Viana vianac at linux.vnet.ibm.com
Thu May 15 21:08:27 UTC 2014


On 15-05-2014 03:51, Hongliang Wang wrote:
> There's some problem with this new function. And there is no need to 
> replace the current validateNonEmpty() function.
>   In the current validateNonEmpty() function, several checks are 
> processed:
Those checks don't make sense if the submit button is disabled while 
some of the required fields are still empty:

>   1)
>   If user name field is empty, then
>     put cursor in user name box
If the user name field is empty, the user won't be able to click the log 
in button; no need to take them back to the user name field.
>   Else if password field is empty, then
>     put cursor in password box
If the password field is empty, the user still won't be able to click 
the log in button; no need to take them back to the password field.
>   Else
>     put cursor on log in button
>
>   2)
>   If some field is empty, a message will show to tell user the field 
> is required.
If some field is empty, the user won't be able to click the log in 
button; no need to display a message on the screen.

Again, I'm trying to make the Kimchi forms consistent. Some forms leave 
the submit button enabled all the time and when the user clicks it, the 
entire form is validated; other forms leave the submit button disabled 
and enable it only when the required fields are filled; some forms 
highlight the required fields when they're empty; some forms remove 
automatically the text entered by the user if it thinks the data is 
invalid (!!); some forms don't even have a submit button visible all the 
time...
I'd like to see a single behavior regarding form validation across 
Kimchi. We can use a combination of those features I mentioned above 
(most of them are nice), but we must decide and use the same approach 
everywhere. Which is not the case right now. I chose one of them to 
create this patch (i.e. keeping the submit button disabled until all 
required fields are filled) so we can start discussing about 
consistency, but I agree we should decide something else better. As long 
as it's applied everywhere and the user always knows what to expect when 
browsing the application.




More information about the Kimchi-devel mailing list