Uppercase and Lowercase

Home Forums Quform WordPress Uppercase and Lowercase

This topic is: not resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5728
    brabox
    Participant

    Hello,

    I am using a code supplied to me before that is working great, which submitted form elements come in as UPPERCASE. (https://support.themecatcher.net/forums/topic/caps-lock)

    //Upercase code for quote forms
    //
    function mytheme_form_uppercase($form)
    {
    foreach ($_POST as $key => $value) {
    if (preg_match('/^iphorm_\d+?_\d+?$/', $key) && is_string($value)) {
    $_POST[$key] = strtoupper($value);
    }
    }
    }

    add_action('iphorm_pre_process_1', 'mytheme_form_uppercase');

    add_action('iphorm_pre_process_2', 'mytheme_form_uppercase');

    I would like to know how to target a specific element (unique id) and make it lowercase.

    Example, on form 1 I have Single Line Text elements with the Unique IDs: iphorm_3_240 and iphorm_3_241. I would like to target these so they wont submit in uppercase.

    Thank you

    #5745
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #5787
    brabox
    Participant

    Thank you Ally,

    Seems to work fine now.

    Just had to add a extra ) at the end of

    if (preg_match('/^iphorm_\d+?_\d+?$/', $key) && is_string($value) && !in_array($key, array('iphorm_3_240', 'iphorm_3_241'))) {

    Thank you!

    #5801
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy