Support » Plugin: Google Forms » Capitalization

  • Resolved mica123

    (@mica123)


    Hello,

    I was wondering about field validation options in Google Forms settings. Not all of them are clear to me, but I was wondering about capitalization. So many users are not very particular about writing their names with the first letter in uppercase. Is there any way to capitalize the input text? The CSS will not be useful because the text will appear in lowercase in the spreadsheet.
    Thanks.

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

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

    (@mpwalsh8)

    None of the user input is modified by the plugin with the exception of encoding the input so it can be submitted to Google. I don’t know if jQuery Validation supports regular expressions as part of the rule set or not, if it does that might be an option to force capitalization of the first character.

    Many thanks for your prompt reply. Supposing jQuery Validation would support this, would that mean that you would be able to add it to your validation options?
    Thanks.

    Plugin Author Mike Walsh

    (@mpwalsh8)

    It might work already based on reading this post on the jqueryvalidation.org web site.

    Set your validation to match on a value and use a regular expression for the matching value. For example, to ensure the first character was a capital letter, you would use something like this:

    [A-Z].*

    That would match any capital letter followed by any sequence of any characters. Your knowledge of regular expressions would allow you to make this fairly complex if you were so inclined.

    Thanks, I’ll try it and let you know.

    In theory this might work (I tested that code elsewhere) – only I am not sure how I can configure it in your Google Forms settings. I added the field name (entry.xxx) in the Google Validation Field box. But I am not sure which Check should be added to it. I tried something but it didn’t really work. The default is set to Enable default jQuery Validation on all required fields. My field is already required – except for the capitalization issue. Would you be able to point me in the right direction? Many thanks.
    By the way did you mean to provide a link to a particular post? The link you gave is for jqueryvalidation.org and I can’t find the post?
    Many thanks again.

    Actually, sorry for adding yet another piece of information:
    I’ve only discovered now that it is possible to configure the regular expression on the original Google Form directly.
    I tried it and it seems to work.
    The only thing is that the error message says “Must match pattern” instead of the custom error message I put into the original Google Form. I suppose I’ll have to add some explanatory note on what it means under the label of the field. Also, I have customized your error messages with my CSS, so the error message does not appear in the way I’d like it to be. I’ll have to dig into it deeper and let you know about any issues. But could you perhaps let me know if this is the way to go?
    Many thanks.

    Again sorry for another addition:
    The “Must match pattern” message cannot be edited with CSS at all – I cannot single it out with Firebug. Just thought I’d let you know.

    Plugin Author Mike Walsh

    (@mpwalsh8)

    I played around with this a bit over the weekend and this is what I learned:

    • jQuery Validate does not have built in support for regular expressions.
    • There are several solutions on the web and Saturday morning when I playing around with this, I went down the wrong path with one of them for a while before abandoning it. I decided to look at it again this morning when I had a few minutes and used a different method and now have a working solution.

    I have just posted a beta release (v0.70-beta-1) which adds a new option, regex, for the validation fields. Please download and check it out and report any feedback.

    As to you posting above, I misunderstood. I thought you wanted to hide the message from Google, which is possible with CSS. Changing the text with CSS to something else is not possible. For that you’d have to use something like jQuery.

    Thank you so much. I tested it very quickly and it seems to work. I’ll do more tests to make absolutely sure, but I wanted to let you know straight away. The only thing is that there is a message saying “Must match pattern” – is this how it is supposed to be? I wouldn’t mind – I was just wondering if it would be possible to highlight it in red?
    Many, many thanks for your help and I’ll get back to you when I do a few more tests.

    Plugin Author Mike Walsh

    (@mpwalsh8)

    I think the must match pattern message is coming from Google Docs. If you remove the validation you added there, do you still get the message?

    Yes, I was absolutely convinced that I had deleted the regex from Google Docs. OK, I deleted them now, but now the values I entered in your Google Forms don’t work. I think I have to start all over again to double check and then I’ll get back to you. I also checked your demo validation form and that would be exactly I would like to see. Perhaps I should delete the updated plugin and reinstall again?
    By the way I saw on your demo validation form the following in Firebug <label for=”entry_1366378410″ class=”wpgform-error” style=”display: none;”>Please check your input.</label>
    I am not seeing this on my test site.

    Plugin Author Mike Walsh

    (@mpwalsh8)

    If you upload the beta-1 version of v0.70 using the WordPress plugin uploader it should overwrite whatever you have installed on your site. You can always manually delete it and manually upload it but the zip file uploader essentially does that.

    As for why you don’t see the “label” element on your form, is your form based on the old version of Google Forms? Google didn’t always include the labels, as I recall they came in when Google Forms changed significantly including the URL format change.

    If you want me to look at your site to see if I see anything obvious I would be happy to do so. The easy mistake is using “entry_NNNNNN” instead of “entry.NNNNN” when setting up the validation rules. It must be the version of the id with with period character in it for it to work.

    I am afraid that I am running into problems so far. First the WordPress plugin uploader is refusing the install the zip plugin because the directory is already there – so I had to delete the directory to install the latest plugin. Yes, I do use the new Google forms – as far as I know. The label I was referring to in my earlier post seems to come from your own plugin – not the Google Docs. So I do not see that in my local site.
    Yes, I do use the correct entry.NNNN.
    I don’t hink I’ll be able to do much more today. I’ll try again tomorrow. But if you do have any ideas for now, please, let me know.

    Plugin Author Mike Walsh

    (@mpwalsh8)

    If you want to fill out my Help and Support Form I will be happy to look at your form.

    Hello there again!
    I am happy to report that it works. Mea culpa. meal culpa. I was looking at another Google Form. Many apologies. This is perfect. I’ll do more testing tomorrow and report back to you.
    I use [A-Z].* as you suggested – works great. I was wondering about an expression to use if for example there was a name like Sarah Ann?
    Anyway I’ll be back tomorrow. Many thanks for your infinite patience and understanding.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Capitalization’ is closed to new replies.