jquery mobile DATEBOX

  You are currently not logged in. You can view the forums, but cannot post messages. Log In | Register

16-Dec-11 08:04
Hi everyone,

I'm building a mobile site, with a contact form that passes the users' input to my email account, and I'd like to use the datebox jquery mobile plugin.

So I've inserted the "Slide with Time" variation in my html (found here: http://dev.jtsage.com/jQM-DateBox/demos/slide/)

The truth is, I'm mainly a designer, and a REALLY BAD coder

So, my question is, how do I code the slider in my php form that sends the submitted data to my email? I've managed to send the name and e-mail address parts, but this slider...well, i've hit a wall.
Any help would be very appreciated.
Thanks,
Leo
19-Dec-11 23:11
@mediamarbles: Not sure what you mean by "php form", but essentially you just need to include the jQuery Mobile CSS/JS and jQuery JS files in the head section of your HTML page that contains the form, as shown here:

http://jquerymobile.com/test/docs/about/getting-started.html

If you can post the URL of your form then I can give you more detailed info.

--
Matt Doyle, Elated
3rd Edition of my jQuery Mobile book out now! Learn to build mobile web apps. Free sample chapter: http://store.elated.com/
22-Dec-11 11:11
Hi Matt,
Thanks for responding. In your book "Master Mobile Web Apps with jQuery Mobile", you have a sample contact form with a .php file (processForm.php) to submit the data.

My question is the following: If my form has a jquery slider input field, or a slide with time input field, how do I declare this in the 'process form.php'?

For example, you use

$senderName = isset( $_POST['senderName'] ) ? preg_replace( "/[^\.\-\' azA-
Z0-9]/", "", $_POST['senderName'] ) : "";

for the name field.

Hope it makes sence to you. By the way, the form example you use in your book, is the first complete jquery/php form that actually works (I mean for us, non-coders), so congrats on a great effort, and wish you great sales.

Leo
07-Jan-12 03:54
Hi Leo,

Ah, I see what you mean. Essentially you need to grab the form field value in PHP, then parse it to extract the necessary date/time info.

eg:


$timeField = isset( $_POST['timeField'] ) ? preg_replace( "/[^\.\-\'\:a-zA-Z0-9]/", "", $_POST['timeField'] ) : "";


where timeField is the name of your date/time field in your form.

It looks like the slider plugin in that demo uses the ISO 8601 date format (YYYY-MM-DDTHH:MMAM/PM), though you can change this using the dateFormat option (view the demo source).

Anyway, whatever format you use for the date/time, you'll need to parse it in the PHP script to turn it into something useful, such as a Unix timestamp (depending on what you want to do with it). This function is very useful for this:

http://www.php.net/manual/en/function.strtotime.php

Hope that helps! Thanks for the compliments on my book.

Matt

--
Matt Doyle, Elated
3rd Edition of my jQuery Mobile book out now! Learn to build mobile web apps. Free sample chapter: http://store.elated.com/

 
New posts
Old posts

Follow Elated