Conditional Web Widget Prefill

4 Comments

  • Ian Goh

    Hi,

     

    Any help from zendesk staff would be greatly appreciated.

    Thanks a lot.

    0
  • Jessie Schutz

    Hey Ian! Sorry for the delayed response here!

    I'm going to see if I can find someone to help you out with this. Sit tight!

    0
  • Joel Hellman

    Interesting question! Essentially: can you interact with the Web widgets "settings object" (for lack of a better name) after the widget has already loaded, and trigger an update of the widget? There are certainly lots of advanced web widget customizations that can only be done through those settings, like the prefill you want here. 

    While I don't think it's possible, I'm not totally sure, and I would also be interesting in hearing what Zendesk has to say on this subject. 

    0
  • Cody

    Hey Ian,


    Thanks for the question. I did some testing and it seems that Joel is correct, the settings object is only looked at when the web widget is loaded. Changing the object after the widget is loaded won't change what displays in the widget. The only way I could see this working is if you included the widget code in your function, so it wouldn't load until the button is clicked. This works from my testing, although it's not as speedy as you'd probably like.

    <script type = "text/javascript" >
    function showonclick() {
    zESettings = {
    webWidget: {
    contactForm: {
    fields: [{
    id: 'description',
    prefill: {
    '*': 'My field text'
    }
    }]
    }
    }
    };

    <!-- Zendesk Widget code -->
    }

    </script>

    0

Post is closed for comments.

Powered by Zendesk