Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Douglas Ludlow 210 posts 366 karma points
    Dec 05, 2011 @ 22:52
    Douglas Ludlow
    0

    Autofilling a field with another field's value using Contour

    Is it possible to fill a field with the value of another field?

    Example: I have a "firstname" field and a "lastname" field and a "fullname" hidden field. I would like to populate "fullname" with a concatenation of first and last.

    I was trying to do this with the bracket syntax (I tried "{firstname} {lastname}", "[@firstname] [@lastname]", and "[%firstname] [%lastname]"), but it appears that the commands are evaluated before the page is rendered, not on submit.

    Any tips or suggestions? Or any other approaches?

    If there is any way to put in a feature request for Contour, I'd request parsing the curly brace syntax after submission.

  • Douglas Ludlow 210 posts 366 karma points
    Dec 06, 2011 @ 00:49
    Douglas Ludlow
    0

    The only options I came up with were to make the changes in a custom workflow, or add some jQuery. I decided on the latter because it was easiest:

    $(document).ready(function() {
    if($('.fullname input[type="hidden"]').length > 0) { //if the fullname hidden field is on the form
    $('.firstname input, .lastname input').blur(function() {
    $('.fullname input[type="hidden"]').val($('.firstname input').val() + ' ' + $('.lastname input').val());
    });
    }
    });
Please Sign in or register to post replies

Write your reply to:

Draft