[Pro] date picker in php form

Hi guys, need some help

I build an php form with easibase and need a date picker in one of the fields field.

What did I do:

insert textfield,
add easy form element and element form styler to it,
add finally ad calender view to it.
Now it looks like this:

http://st-job.nl/cms/test.php

This looks good, I can picked a date, date is shown in the field, but my output (mail message) only shows the year , not the picked date and month.

What I’m doing wrong?

thx for your feedback

Erik


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

You have three fields with exactly the same name, only the last one will “win”. If you want to combine these three you have two options:

  1. Use three separate field names, and have the server put them together (or just store day, month, year in your database).
  2. Use JavaScript to stitch the three field values together before the form is submitted.

I see you have experimented with the CalendarView Action elsewhere on the page, that’s another very easy way to handle this.

Walter

On Sep 14, 2012, at 5:47 AM, Erik wrote:

Hi guys, need some help

I build an php form with easibase and need a date picker in one of the fields field.

What did I do:

insert textfield,
add easy form element and element form styler to it,
add finally ad calender view to it.
Now it looks like this:

http://st-job.nl/cms/test.php

This looks good, I can picked a date, date is shown in the field, but my output (mail message) only shows the year , not the picked date and month.

What I’m doing wrong?

thx for your feedback

Erik


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

Hi Walt,

What I preffer is the calender view over here:

http://st-job.nl/cms/test.php (in the form)

but in this way the output is only 2012?
What do you mean by different names?

the formfield has a name, to the form field I added the calenderview

Erik


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

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

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

Mercedes taxis. Sweet. Makes me want to use public transportation. :slight_smile:


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

thank you Waltd and Dave for your help in this!

It works now!

Erik


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

Pardon?

On Sep 14, 2012, at 10:12 AM, RavenManiac wrote:

Mercedes taxis. Sweet. Makes me want to use public transportation. :slight_smile:


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

Hi Waltd,

Any experience with API? and google maps?

on the same website www.st-job.nl is running a script:

http://st-job.nl/cms/ritprijsberekeni.html

(it is a taxi calculation module)

the problem is that I’m getting everytime errors from Google:

“Google has disabled use of the Maps API for this application. The provided key is not a valid Google API Key, or it is not authorized for the Google Maps Javascript API v2 on this site”

I’m sure the key is valid and the script worked before, not anymore you see


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

The website you’re helping out with. It’s a taxi company—that uses Mercedes. :slight_smile: Sorry, I was just being silly. Can I still stand here?


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

Couldn’t see the forest for the trees, sorry.

Walter

On Sep 14, 2012, at 10:44 AM, RavenManiac wrote:

The website you’re helping out with. It’s a taxi company—that uses Mercedes. :slight_smile: Sorry, I was just being silly. Can I still stand here?


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

Google has discontinued API v2, and requires v3 now. Although some of their products that required a key no longer do – confusing. Try removing the key entirely (and the version attribute) and see if it starts working again.

Walter

On Sep 14, 2012, at 10:41 AM, Erik wrote:

Hi Waltd,

Any experience with API? and google maps?

on the same website www.st-job.nl is running a script:

http://st-job.nl/cms/ritprijsberekeni.html

(it is a taxi calculation module)

the problem is that I’m getting everytime errors from Google:

“Google has disabled use of the Maps API for this application. The provided key is not a valid Google API Key, or it is not authorized for the Google Maps Javascript API v2 on this site”

I’m sure the key is valid and the script worked before, not anymore you see


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

There is also an article on the knowledgebase you should read

D


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

Yeah are read it,

But this won’t solve my problem
still getting the same error

API key is valid in my opinion, it is something else.

I’ll post a new thread for this subject maybe this will help

thx for your feed back

Erik


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