There are 3 fields named TextField1,TextField2, and TextField3. If user enter "B" in TextField1, "A" in TextField2, and "D" in TextField3, when this file will be closed the value will be rearranged alphabetically. So, "A" in TextField1, "B" in TextField2, "D" TextField3.
Is it possible to do? If so how I can get it?
Also, there is another field named "summarry". All value will be popuated alphabetically.
In addition, the 1st initial of the value will be considered to order alphabetically.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
Have a look at John Brinkman's post: http://blogs.adobe.com/formfeed/2009/05/sort_subforms.html.
Here he has a function that you can use to sort subforms/table rows. I've used it here and it works well. You might want to call it on docReady event maybe.
Good luck,
Niall
Views
Replies
Total Likes
Hi,
Have a look at John Brinkman's post: http://blogs.adobe.com/formfeed/2009/05/sort_subforms.html.
Here he has a function that you can use to sort subforms/table rows. I've used it here and it works well. You might want to call it on docReady event maybe.
Good luck,
Niall
Views
Replies
Total Likes
Here's a quick solution using an array.
Put this JavaScript into the layoutReady:event of the summary field.
Hi Nial!
I thought it was not possible. Great!!
In variable scMessage is used. Would you clarify it.
Thanks
Views
Replies
Total Likes
Hi radzmar,
Thanks a lot. Your script accomplishes my project.
I thought it would be a large script but you have done a simple script.
Really great!!!!!
Thanks again.
Views
Replies
Total Likes
Hi,
In John's solution he is calling a function "sort" in a script object "SubformSort".
Within this function, he is calling another function "handleError" in a different script object "scMessage".
So if you are using John's solution, you should include BOTH script objects.
Good luck,
Niall
Views
Replies
Total Likes
Thanks a lot.
I have made a sampe. it works perfectly.
Views
Replies
Total Likes
var aWords = [];
aWords.push(TextField1.rawValue);
aWords.push(TextField2.rawValue);
aWords.push(TextField3.rawValue);
aWords.sort();
this.rawValue = aWords.join(",");
If I use add row button to increase the TextField1. In this case if I remove TextField2, TextField3 and use only TextField1, how can I get value into summary field from increased TextField1 (TextField1[0], TextField1[1], TextField1[2]........)
Actually what happen when add row buuton is used that means what the name of increased fields is?
Views
Replies
Total Likes
Hi,
If the TextField1 is in a repeating Row1, then the reference would be more like:
Table1.Row1[0].TextField1, Table1.Row1[1].TextField1, Table1.Row1[2].TextField1, etc...
See an example here: http://assure.ly/kUP02y. Have a look at the table examples.
You would need to loop through the repeating instances and build the string. Using Radzmar's script as an example:
var aWords = []; // create an array variable
var nRows = xfa.resolveNodes("Table1.Row1[*].TextField1"); // resolve all of the repeating instances
// Loop through the rows
for (var i=0; i<nRows; i++) {
aWords.push(nRows.item(i).rawValue);
}
aWords.sort(); // Sort the array
this.rawValue = aWords.join(",");
You will need to adjust the script for your form.
Niall
Views
Replies
Total Likes
Hi,
It should work but no result in Summary field.
I have attached file. You can see my fault.
https://acrobat.com/#d=MBul5jUxNChzF9SmN1izfQ
Thanks
Views
Replies
Total Likes
My bad!
I have forgotten to use the .length property of the resolveNodes nRows in the for statement. See below:
var aWords = []; // create an array variable
var nRows = xfa.resolveNodes("Table1.Row2[*].Cell1"); // resolve all of the repeating instances
// Loop through the rows
for (var i=0; i<nRows.length; i++) {
aWords.push(nRows.item(i).rawValue);
}
aWords.sort(); // Sort the array
this.rawValue = aWords.join(", ");
https://acrobat.com/#d=qJSC7nD*bJGU0RJyn9qgvA
Niall
Thanks
Now working perfectly.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies