Radio Buttons Text

I am using Plumsail forms to create a rather long questionnaire. I am using plumsail actions to create a Word document from a docx template and I am wondering if there is any way to make all the radios a JSON list/array that I can use in the document template.
Currently I am mapping every single radio into a table but would like to have that happen dynamically with an input such as {{list.radio}}

Another thing I would like is the option to get the radio text as JSON data into MS flow. In my example that would be the question that I am asking with a radio selection as the answer. I cannot find any way to solve this, either in the documentation or through a descent amount of exploration and experimentation.

Is this in anyway possible?

I am mostly loving Plumsail forms so far though!

Dear @SiggiBSI,
We’re glad to hear that you like the product! In the near future, we are planning to release a new field which will be very useful for questionnaires, and it should solve your first issue!

Until then, I am afraid there is no easy solution here, unless you were to transform the result prior to submission with JS, but you’ll also need to change the schema, and I can’t say I recommend this approach.

Answer to the second question is similar, but you don’t need to change the schema, so it’s much safer. Simply use the beforeSave() event and add Field’s title, to its value - either in the field or directly to data, like this:

fd.beforeSave(function(data) {
    data.Field1 = fd.field('Field1').$el.title + ' ' + data.Field1;
});

Thanks for the promt reply! I will probably make do with the second answer until the new questionnaire feature is released. But in case I change my mind or get curious where can I find documentation or instructions on editing the JSON schema.

Dear @SiggiBSI,
Now, there is no documentation on this process, as we do not recommend doing. The main reason - the process might slightly change in the future, make it more automated, and this might break functionality of your existing forms, which as you understand is far from perfect.

What could be a better option instead, is to hide (Style: display: none;) a DataTable control on your form, where every single field will be duplicated as a row. For example, you can have two text columns - Question and Answer. Then, on form submission, take every Radios field, and insert a separate record for each one into the table.

Code like this should do:

fd.beforeSave(function() {
    var answersTable = [];
    
    var question1 = {};
    question1.Question = fd.field('Radios0').title;
    question1.Answer = fd.field('Radios0').value;
    answersTable.push(question1);
    
    var question2 = {};
    question2.Question = fd.field('Radios1').title;
    question2.Answer = fd.field('Radios1').value;
    answersTable.push(question2);
    
    var question3 = {};
    question3.Question = fd.field('Radios2').title;
    question3.Answer = fd.field('Radios2').value;
    answersTable.push(question3);
    
    fd.control('DataTable0').value = answersTable;
});

Then you can access the array of DataTable values inside the Flow without fiddling with the schema.

1 Like