Support » Plugin: Calculated Fields Form » Change value by clicking at picture

  • Resolved dako77

    (@dako77)


    Hello,
    I would like to change value of one of fields by clicking at href πŸ™‚ When I click at image or text – it will preddefined value of one or more field πŸ™‚

    how is this possible πŸ™‚

    Thanks πŸ™‚

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @dako77,

    Honestly I don’t understand your question. If there is an image in your form and you want change the value of a field when the image is clicked, first, assign a class name to the image, for example: my-image, and then, you can insert a “HTML Content” field in the form, with a piece of code similar to the following one as its content to assign the value to a field in the form, for example, to the fieldname1 field:

    
    <script>
    jQuery(document).on('click', '.my-image', function(){jQuery('[id*="fieldname1_"]').val(123).change();});
    </script>
    

    and that’s all.
    Best regards.

    Yeah thats it πŸ™‚ Thank you πŸ™‚ It helps me.

    Is there nicer way how to write this code if I want work with 5 images and I want edit 2 fields once? πŸ™‚

    If not, is not problem.

    By the way this is big help for me πŸ™‚

    Plugin Author codepeople

    (@codepeople)

    Hello @dako77,

    The plugin can be extended as you want, and of course, if you need specific behaviors, you need to enter your own code.

    An alternative would be duplicate the code for every image, using the corresponding image’s class name, the fields’ names and the values to assign, but there are multiples alternatives.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change value by clicking at picture’ is closed to new replies.