Support » Plugin: Google Forms » date format

  • Resolved lking57

    (@lking57)


    Raw google forms (from google) uses

    <input type=”date” name=”entry.2007389910″ value=”” class=”ss-q-date required” dir=”auto” id=”entry_2007389910″ aria-label=”Event Date ” aria-required=”true” required=””>

    to gather a date, but Google Forms (your plugin) uses month date year selects like

    <select name=”entry.2007389910_month”><option value=””>Month</option>
    <option value=”1″>January</option> <option value=”2″>February</option> <option value=”3″>March</option> <option value=”4″>April</option> <option value=”5″>May</option> <option value=”6″>June</option> <option value=”7″>July</option> <option value=”8″>August</option> <option value=”9″>September</option> <option value=”10″>October</option> <option value=”11″>November</option> <option value=”12″>December</option></select>

    Is this something which can be controlled? I didn’t see how.

    https://wordpress.org/plugins/wpgform/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Mike Walsh

    (@mpwalsh8)

    Looks like I lost my previous answer to this question.

    The Google Forms plugin renders the HTML which Google provides. What I suspect is happening is Google is smart enough (no surprise there) to detect when a browser supports HTML5 and it will send a single entry box which has the type=”date” attribute defined by HTML5. If it doesn’t detect HTML5 support, then the three select boxes are sent.

    To validate this, try opening your Google Form (the full Google Drive URL) with IE and using the Developer tools, have IE emulate IE7. You will see the calendar assist go away and you’ll be left with three select boxes (plus some other errors).

    I also tried fetching the form URL using cURL from the command line under Linux and the HTML which was returned contained three select boxes for the date which is why you see them using the plugin. The plugin fetches the HTML using the WordPress HTTP API which is usually accomplished via cURL.

    Hopefully that explains why you’re seeing the three select boxes – now trying to figure out what to do about it is the next question. The answer is, I am not sure. I am not sure if it possible to have cURL tell Google it is HTML5 capable. I’ll have to do some looking.

    One thing you could do is define the form within Google using a simple text box then use the validation functionality within the plugin to make sure it is a valid date.

    Ok, thanks. If you have time and find a way to do this that’d be great. Otherwise, I’ll just deal with the current solution, or make a text box like you suggest.

    IE7 didn’t work at all. Stopped at an unhandled exception than could not get its attention after that. Maybe I gave up too early, but I’ll take your word for it. 🙂

    Plugin Author Mike Walsh

    (@mpwalsh8)

    So I’ve been thinking about this since my last post and did some experiments while I was at my daughter’s basketball practice. It turns out, I am able to send the user agent to Google using the HTTP API. I have modified the plugin to do so and did some testing.

    If you visit this form using Chrome, the date field at the bottom will be a single text box with a date picker. If you look at the HTML source you will see the field is an input of type “date”.

    Now if you visit the same form using either IE or Firefox, you will see the three select fields. Google is definitely serving up different HTML based on the user agent string. IE supports the input of type date field so I am not sure why Google doesn’t send it.

    Much to my surprise, and I need to do some more testing, Google also send the three select boxes to my iPhone.

    Thanks for looking at this, Mike.

    And really appreciate your plugin. I’m going to get a lot of use out of it.

    Plugin Author Mike Walsh

    (@mpwalsh8)

    Here is another test form which just has times and dates on it (time fields will have the same problems).

    I’ve looked into what Google sends for IE and FF and it appears there is some Javascript and CSS they include with the page for the form to work in the Google Docs context. My first impression is the way the Javascript and CSS is defined, there is no clean way to reference it in order to include it.

    Plugin Author Mike Walsh

    (@mpwalsh8)

    I have made a slight improvement for this issue in v0.79 which I released today. The user-agent string is passed along through the HTTP API when the form is requested from Google.

    The net result is the form will work as expected with Chrome but all other browsers, as near as I can tell, will end up with the separate select boxes for the time and date fields.

    I’ve written up a post explaining what is actually happening and why the fields don’t appear the same as they do in Google Drive on my site.

    Yup. Looks as I’d hoped in chrome, but as three selects in IE, Firefox and Safari (whatever version I have on my windows laptop 😉 )

    Looks like this is the best it will be for now, so marking “resolved”.

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘date format’ is closed to new replies.