Copied to clipboard

Flag this post as spam?

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


  • BartKrul 8 posts 88 karma points
    Oct 19, 2016 @ 10:30
    BartKrul
    0

    Umbraco forms: use images as radiobuttons.

    Hi,

    I'm looking for a way to put images into my umbraco form which the user can click (a happy and sad face). they are to be used as radiobuttons, but I have no clue on how to start doing this. I 'have trouble finding documentations or threads that answer my problem.

    Can someone help?

    Thanks in advance,

  • Christopher 28 posts 173 karma points
    Oct 19, 2016 @ 11:26
    Christopher
    100

    I recently did this exact same thing on the Healthy Young Minds site with restricted timescales.

    Effectively created a proxy so the smiley faces are plain HTML items (li's) and when clicked use client-side JavaScript to select the relevant form radio button (notated by a [data-target] attribute) and submit the (hidden) form; and handle the response.

  • BartKrul 8 posts 88 karma points
    Oct 19, 2016 @ 15:36
    BartKrul
    0

    Hey Christopher,

    The first part is working. I use a modal that shows the smileys faces, and I'm able to fill the umbraco form based on what smiley is clicked. I was wondering how you posted the form. The form doesn't have an Id like the radiobuttons for example. I tried giving the form an id by getting the form out of the div it is nested in with ` document.getElementById("contourform432a28f341884231b1acdefd863ebc85").firstChild.id = "postForm";

    But this doesn't seem to work as it messes up my html.

  • BartKrul 8 posts 88 karma points
    Oct 20, 2016 @ 08:09
    BartKrul
    0

    This worked:

        var parentDiv = document.getElementById("contour_form_432a28f341884231b1acdefd863ebc85");
    var list = parentDiv.childNodes;
    list[1].id = "actualForm";
    document.getElementById("actualForm").submit();
    
  • BartKrul 8 posts 88 karma points
    Oct 19, 2016 @ 13:29
    BartKrul
    0

    Thanks!

    I'll do just that! It's a bit inconvenient as it would be alot easier to just use a basic umbraco form, but the client wants what the client wants.

Please Sign in or register to post replies

Write your reply to:

Draft