Issue with rule to set multi-choice field

Forums Dynamic Forms for SharePoint Issue with rule to set multi-choice field

This topic contains 1 reply, has 2 voices, and was last updated by  Alexander Bautz 4 months ago.

  • Author
    Posts
  • #19916

    Ivan Wilson
    Participant

    Using DFFS Backend v4.3.38, spjs-utility version 1.319

    I have rules that sets a value for a choice field using the “set field value” setting. Some of these rules do not work. Everything looks fine when setting up the rule, but when I run it, the wrong value is set. Debugging the rule shows the same behaviour as I see on the form. If I reload the DFFS backend, the “set field value” no longer has any value specified.

    Other rules on the same form are setting the same field to the same value without problems. This issue is happening for the two people editing DFFS rules. Deleting and adding the “set field value” config doesn’t make any difference. Changing the option to specify my own value does work.

  • #19923

    Alexander Bautz
    Keymaster

    Thanks for the feedback, I have verified this bug and will fix it in the next release. What causes it is that when clicking a radio or checkbox in the set field value section for a choice column, the script executes before the input has actually been properly “checked” and fails to pick up the value and write it to a hidden text input. To work around this issue, you can click the desired value two times to ensure it is set, or you can drop this snippet in your custom js:

    spjs.dffs.setFieldValInput = function (elm, id) {
        var val = [];
        setTimeout(function(){
            jQspjs("#" + id + "_wrap").find("input").each(function () {
                if (jQspjs(this).prop("checked")) {
                    val.push(jQspjs(this).val());
                }
            });
            jQspjs(elm).parents("table:first").find(".dffs-setfield-input").val(val.join("|"));
        },100);
    };

    Alexander

You must be logged in to reply to this topic.