"Laphan" <admin.DeleteThis@DontSpam.com> wrote:
Wow, why didn't you post in even *more* groups?
> Hi All
>
> I need to provide a function on my site whereby a user can enter a
> number of ip addresses (one per line) so that I can submit this en
> masse to string holding space in my db.
>
> My problem is that I want to keep this list sorted as they enter the
> ip addresses and I want to check for duplicates so that they don't
> enter the same ip addresses twice.
The former is extremely annoying in my experience. I expect something I've
added to appear on the bottom of a list. If you keep a list sorted, people
might have to scan the whole list to see where it went.
As checking for duplicates, that should be a piece of cake in any
language, no need to keep it sorted. The keyword is a hash table (aka
associative array), I am sure JS does support something like that out of
the box. But read on...
> I was going to do this as a simple form submit and add each entry as a
> database row so that I could ORDER BY to get the sort and check for
> duplicates on the submit,
Assuming MySQL, you can safely insert duplicates by overwriting them with
ON DUPLICATE SET ...
If you put on top of your form: duplicates will be ignored, the user knows
what happens when he/she sees he's entered a duplicate. If he/she has
entered a duplicate it's already too late. I mean, you can remove it while
the line is entered, but the question is (to me): should you. And I would
say: no. (Also, without any warning the user wonders where the line went
she/he just entered).
--
John Bokma
http://johnbokma.com/