Support » Plugin: Contact Form 7 » How add a reference number by submit

  • Hi,
    your plugin is very nice for me.
    I would like to add a reference number wich be generated by clicking the button of submission. How can I do please?
    I tried a little script in the form but if you don’t refresh the page it’s every time the same number if you submit more than one message (exemple of use : http://www.toulouseclubpatinage.com/leboncoin/)
    Thanks a lot for your help…
    See you soon

    exemple of script use in the top of the Form :

    <script>
    var tD = new Date();
    var AReference=tD.getFullYear() + "/" + (tD.getMonth()+ 1) + "/" + tD.getDate() + "-" + tD.getHours()+tD.getMinutes()+tD.getSeconds();
    document.write("<input type=’hidden’ name=’Ref_Annonce’ value=’"+AReference+"’>");
    </script>

    and in the message I put [AReference]

    http://wordpress.org/extend/plugins/contact-form-7/

Viewing 5 replies - 1 through 5 (of 5 total)
  • hi,
    a little up…!
    Is there somebody to help me, please…?
    Thanks…

    hi!
    nobody to help me???

    a little bug in the message…. you have to see:
    and in the message I put [Ref_Annonce] and not [AReference]

    Thanks

    Best wishes…

    I managed to get something similar working. It generated a reference comprising the Unix timestamp with 4 random alphanumerics appended.

    This is the code I added to functions.php

    function genTicketString() {
        $length = 4;
        $characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
        for ($p = 0; $p < $length; $p++) {
            $string .= $characters[mt_rand(0, strlen($characters)-1)];
        }
    	$string = time() . $string;
        return $string;
    }
    add_shortcode('quoteticket', 'genTicketString');

    I used the Contact Form 7 – Dynamic Text Extension plugin to allow me add the [quoteticket] shortcode to the form.

    grols

    (@grols)

    Hi Jim
    Thanks a lot for your reply,
    I tried it but it don’t match…
    I put your code in function.php of theme I use and I put in my form
    [dynamichidden Ref_Annonce “CF7_GET key=’quoteticket'” ]
    what’s wrong?
    Please.
    Thanks
    See you soon…

    Jim Daly

    (@glicit)

    In your case [dynamichidden Ref_Annonce “quoteticket”] should work.

    Return the value in the email using [Ref_Annonce]

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How add a reference number by submit’ is closed to new replies.