Each field in a form must have a unique name attribute. In Freeway, you set this attribute using the Inspector, in the third tab from the left (Name field). The Title field (on the first tab) is meaningless in this context. When you submit a form to a server, the server receives an associative array (or hash) of values, like this:
POST(
'name' => 'Walter',
'city' => 'Philadelphia',
'date' => '2012-09-14'
}
Each of these field names is different, so the data comes through clearly. Now look what happens if you have more than one field with the same name:
POST(
'name' => 'Walter',
'city' => 'Philadelphia',
'date' => '09',
'date' => '14',
'date' => '2012'
}
The server gets that, and in rapid order says: “date equals 09, date equals 14, date equals 2012”. Each time, it overwrites the previous value of the date with the current value until it reaches the end. You only get the last value you send, not all of them together.
Now there is a trick you can use in PHP and Ruby (possibly others, but I have far less experience) involving square brackets. The trouble is, you will need to handle this on your server side:
Month: <input name="date[]" />
Day: <input name="date[]" />
Year: <input name="date[]" />
in your form, will post like this to the server:
POST(
'name' => 'Walter',
'city' => 'Philadelphia',
'date' => (
'0' => '09',
'1' => '14',
'2' => '2012'
)
}
Adding an empty (or uniquely filled) square bracket pair to the end of the field name causes the array posted to the server to become nested, so that instead of having one variable overwritten with each turn of the loop, you have unique indices within that one variable: date[0], date[1], and date[2]. But then you have to do something with those values in order to turn them back into a date you can store in your database. I don’t know the internals of the Easibase form handler, but it is possible if you hand-code the handler.
The other way around this is to use JavaScript on the browser to stitch these three values back together into one value that gets posted to the server. That way, no additional code is needed on your server. I’ve written some scripts in the past that take a single text field containing a date value and burst it out into three pickers when the form is displayed, and condense them back into the single text field value when the form is submitted. It’s quite a lot of engineering for such a little thing, but it serves the purpose of not having to use a custom form handler to store a date value.
Walter
On Sep 14, 2012, at 9:07 AM, DeltaDave wrote:
What I preffer is the calender view over here:
This page is picking up the value from the date selector off to the right. Remove any date pickers apart from the one in the form on the page and try again.
David
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options