Is there a way to pass the contents of a collection between two forms as parameters in a starting URL?
Thanks
Is there a way to pass the contents of a collection between two forms as parameters in a starting URL?
Thanks
Hi Ken,
See here.
Only fields outside of collections and tables can be populated via parameters. Address, radio button, checkbox, file upload, and signature fields cannot be populated in this way.
Hi Tri,
Despite what the help doc says on this, I was able to prefill radio buttons and check boxes with the help of posts from others using Java. For example : https://answers.laserfiche.com/questions/86912/Prefill-Checkbox-with-selected-values-via-URL#86933
I can't seem to find anyone posts where others have been able to prefill collections using Java yet.
Thanks
Yep, this works. It's also useful for augmenting the field lookup function, which won't populate tick boxes and radio buttons.
Ken,
I was answering the question of whether it was supported directly with URL parameters. You could certainly use JavaScript to pass basically anything from one thing to another, e.g. radio buttons, as in the post you linked.
Here's a simple example of passing single line field values in a collection into a hidden field, whose value is passed into a URL of a different form.
$(document).ready( function() { // Declare variables var count = 1; var arraySL = []; // Determines amount of rows in original collection function updateCount () { var count = document.getElementsByName("q3").length; //q3 is a single line in the collection $('.count input').val(count); } $('.collection .cf-collection').on('click', '.cf-collection-delete', updateCount); $('.collection .cf-collection-append').on('click', updateCount); // On Form submission, read and push all the values into their respective arrays $('.Submit').on('click', function (){ for (var i = 0; i < $('.count input').val(); i++) { n = i + 1; arraySL.push(document.getElementById("Field3(" + n + ")").value); } alert(arraySL); $('#q7 input').val(arraySL); // single line collection field that is hidden and passed as URL }) });
On form submission, all of the values inserted into the single line fields are pushed to an array. It also keeps count of how many rows are in the collection.
In the second form, you pass over the row count and the array. Use JavaScript to set the number of rows, and split out the array and insert them into their proper fields. The code above should give you running start for that, you're just trying to do the opposite. (Instead of reading the collection and pushing it into the hidden fields, you're reading the hidden fields and pushing into the collection.)
Thanks Tri!