[html-formfu] Re: Min, max and amount of new_empty_rows

Oskari 'Okko' Ojala okko+formfu at frantic.com
Wed Feb 25 15:52:36 GMT 2009


On Wed, 25 Feb 2009, Carl Franks wrote:

> It won't work quite as you proposed, but you will get the same
> functionality - though you'll have to use the new config options,
> rather than 'new_empty_row', which will be deprecated, and will issue
> a warning.
>
> One of the reasons this needed fixed, was the idea of using a min/max
> Range is very restrictive, as it can only be used when creating the
> first records, and not when adding more - as you don't know how many
> there'll be in advance, so can't set the min/max correctly. This is
> something that will be fixed.

Sounds great!

Some thoughts:

To me using the max range makes sense and the coder can know the amount 
of max rows in advance if the backend system for example
 	-accepts a maximum of n item rows in an order
 	 ("we'll ship up to 3 different products in a single order")
 	-accepts a maximum of n photo id's to an article
 	 ("can't show more than 10 pics in an article")
 	-accepts a maximum of n traveller names to an airline ticket order
 	 ("if you want to order more than 9, contact our group sales")

These also apply when editing, for example, an article. Of course FormFu 
should elegantly handle the situation when there are more fields found 
from the database than presumed. I think it should then display all fields 
found (even if exceeding the max) and just not allow adding more.

I could also think of using the max as a limiter to prevent malicious use 
like to prevent adding 1000 images to a single forum post etc.

The way I use the limiters is to give out enough fields when inputting new 
items and editing old, so that the user doesn't have to do anything to 
"get more" of them visible.

This comes down to the wish that there would be 3 numbers to configure:
 	-Minimum amount of repetitions
 	-Maximum amount of repetitions
 	-Amount of new empty repetitions

and they would be used so that
-the resulting min is min amount or amount of new, whichever is bigger
-the resulting max is max amount or amount of existing plus amount of new, 
whichever is smaller.


I'm using it with min: 10, max: 15, new_empty_row_amount: 10. My idea is 
"Always give out 10 empty, but only up to 15 when including the existing 
ones".


Looking forward to seeing your solution!

-- 
Oskari "Okko" Ojala



More information about the HTML-FormFu mailing list