[Pro] submit to list form

What sort of file handler are you using on your server to “catch”
these? There’s a way to do this in either Ruby or PHP, where you name
the fields with a trailing square-bracket block, like this:

<input name="lastname[]">

What happens when you do that is you can have more than one field with
the same name. The multiple fields are sent to the server as an array:

lastname = array(
	0 => 'Smith',
	1 => 'Jones'
}

And if you have say ten firstname[] and ten lastname[] fields in the
same form, in the same source order, the arrays will be aligned so you
can pluck out firstname[1] + lastname[1] and plop them in the same
database row.

So to add more of these to your page, you would create a JavaScript
function to insert more of them as needed, using a click for more link
or icon. I’d use Prototype for this, using my Protaculous Action.
You’ll need some sort of structure to your page, at least a DIV with a
paragraph per row, or a table, or a list. There just has to be some
framework you can hang things off of. Your add-more link needs to have
an ID attached to it, so you can find it in the DOM later.

So if your page looks like this:

You could add 5 more rows with the following JavaScript pasted into
the top Function Body dialog in Protaculous.

You’ll have to check the way you lay out your page, and make any
necessary changes to your script to match how you have positioned the
fields.

As far as catching these on the server, it’s just a matter of looping
through each of these fields, checking to see if all the parts are
there, and making a new entry in the database if they are.

Walter

On Sep 20, 2010, at 2:41 PM, Ginjg wrote:

Is this doable? I want to build a form that allows people to submit
a list of names for alphabetical entry into a master db.

I know how to do the basic part for the personal info and the
donation payment.
It’s collecting the list in a manageable way that’s throwing me.
Currently they’re just putting them in a text box, but few follow
the instructions, so it’s taking a lot of time to get the names
rearranged to be sorted.

I’d like the add to master list portion to have 3 - 5 rows of 3
fields to start, and an “add more” button that would give another
set of rows ( some people have 15 - 20 names at a time) and of
course a submit button that sends the names to the masterlist db and
takes the user to the payment interface

the 3 fields are lastname, firstname, pronunciation


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Walt,

PHP because I rely mostly on joomla for the hardcore db stuff (lazy
on my part, I know), but couldn’t find an extension that does this.

Thanks for the outlining how to do this. It seems pretty straight
forward, but I can see that this is beyond my current skill level.
I’ve only done the very simplest of forms on my own; I haven’t played
with protaculous or prototype yet. I’ll have to practice this
through until I can master it. I have some time before it’s needed
again, so I’ll make it my pet project.

Again thanks. I use your tips to others on occasion and truly
appreciate the time and expertise you share with the freewaytalk
denizens.

Ginger

On Sep 20, 2010, at 1:25 PM, Walter Lee Davis wrote:

What sort of file handler are you using on your server to “catch”
these? There’s a way to do this in either Ruby or PHP, where you
name the fields with a trailing square-bracket block, like this:

What happens when you do that is you can have more than one field
with the same name. The multiple fields are sent to the server as
an array:

lastname = array(
0 => ‘Smith’,
1 => ‘Jones’
}

And if you have say ten firstname[] and ten lastname[] fields in
the same form, in the same source order, the arrays will be aligned
so you can pluck out firstname[1] + lastname[1] and plop them in
the same database row.

So to add more of these to your page, you would create a JavaScript
function to insert more of them as needed, using a click for more
link or icon. I’d use Prototype for this, using my Protaculous
Action. You’ll need some sort of structure to your page, at least a
DIV with a paragraph per row, or a table, or a list. There just has
to be some framework you can hang things off of. Your add-more link
needs to have an ID attached to it, so you can find it in the DOM
later.

So if your page looks like this:

expando-form.html · GitHub

You could add 5 more rows with the following JavaScript pasted into
the top Function Body dialog in Protaculous.

http://gist.github.com/588564.js

You’ll have to check the way you lay out your page, and make any
necessary changes to your script to match how you have positioned
the fields.

As far as catching these on the server, it’s just a matter of
looping through each of these fields, checking to see if all the
parts are there, and making a new entry in the database if they are.

Walter

On Sep 20, 2010, at 2:41 PM, Ginjg wrote:

Is this doable? I want to build a form that allows people to
submit a list of names for alphabetical entry into a master db.

I know how to do the basic part for the personal info and the
donation payment.
It’s collecting the list in a manageable way that’s throwing me.
Currently they’re just putting them in a text box, but few follow
the instructions, so it’s taking a lot of time to get the names
rearranged to be sorted.

I’d like the add to master list portion to have 3 - 5 rows of 3
fields to start, and an “add more” button that would give another
set of rows ( some people have 15 - 20 names at a time) and of
course a submit button that sends the names to the masterlist db
and takes the user to the payment interface

the 3 fields are lastname, firstname, pronunciation


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

So what form handler are you using? I know there are a lot of plugins for Joomla that can accept a form, some of them are pretty open and would catch a form such as this. The JavaScript part would work in any form page.

Walter


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options