Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Buttons that will sort data in table when clicked

teresag127
Level 1
Level 1

How can I make a form with a table that has buttons at the top to sort the user entered data? I want it to look like this: Like this: http://blogs.adobe.com/formfeed/files/formfeed/Samples/SalesReport.pdf

10 Replies
Magus069
Level 10
Level 10

Hi there,

why aren't you using the functionality created in the form you provided?

Magus069
Level 10
Level 10

The function seems very easy to use, but you gotta make sure that each of your values for your forms are correct...

1. Make sure you have the Script Objects names well written...

2. When calling the function sort(); the first value is the button itself which is "this", that never changes

3. the 2nd value is the instance manager of the row of your table

3. The 3rd value of the function is the name of the field that is in the column of the button clicked, so when calling the function sort, it will look for each instances of that object you specified to sort the rows...

You don't need to change any more code for the sorting, just make sure your values are well written and everything should be fine..

If it is still not working, have a look at the JavaScript Debugger pressing Ctrl + J and look at your error!

Hope this help!

teresag127
Level 1
Level 1

Thanks for breaking it down for me.  I have my headings (buttons) in a master page subform.  Is that correct?

Magus069
Level 10
Level 10

That could cause errors, do you have a specific reason to put them in the master page??

Interacting with objects from master page to pages or pages to master pages may be very difficult...

I suggest you to have your whole table in a Page and not a master page..

teresag127
Level 1
Level 1

Thank you so much for your help! I feel like I am close, but not quite

there. This is what I have in the ScriptEditor: functionsort(this,Row1,

TextField1) and I have verified that "this" is my button, and the row and

text field are called the correct names, but it still won't work. I put it

all on the same page, too. It shows no errors in the javascript.

Thank you!

Magus069
Level 10
Level 10

you should be calling the function this way :

_Row1 is equivalent to Row1.instanceManager, which is the object that the function is expecting to receive.

The 3rd value is expecting to receive a name, so a string is the expected value...

By sending TextField1 without quotes, you send the whole object of TextField1 but it only wants to receive the name of the field, so "TextField1" is more likely what you have to send in parameter!

teresag127
Level 1
Level 1

Still no go. Is there a way I can send you my form?

teresag127
Level 1
Level 1

Do I put that script in the ScriptEditor of each button? or in the subform?

I've tried both ways with no luck, so far.

teresag127
Level 1
Level 1

Thanks again for your assistance! What a relief to have it finally correct!