Action Buttons on Form Pages (BETA)

I am beta testing unreleased improvements in Five. Jason explained how to add action buttons on a form or list. He also stated that I could put these buttons on the top of the form, and also pages on the form. I can’t figure out how to do the latter.

I can put buttons on the top of the form. My use-case is to have a form for my reports. There is a General page showing the report name. There is a Join page showing which study groups are attached to the form, using my ReportGroups join table. Now it shows every group on the join page, and those who have an entry in the join table will show as true on their checkbox. If I click another group in the join table, it will switch to true and add a record to the join table. This is working good now.

What I want to do is have a “Select All” button and a “Select None” button which will add all group records to the join table or remove all from the join table. This could be accomplished via a function which would update the join table.

It doesn’t make sense to have these buttons at the top of the main Reports form, because I will need multiple join pages on the form, each one of which will need these buttons. So how do I add action buttons to the top of a form page? I tried adding action buttons on the definition of the form itself (the one used as a join page on the Reports form), but they don’t show on the join page. There is no “Action Buttons” section available on the page itself. But Jason said it could be done. Please advise if I misunderstood him. Thanks…

Hi Ron,

the page type “Join” doesn’t support action buttons, unfortunately. So you won’t be able to add these buttons above or below the join. Users will have to select/deselect all records that they would like to include in their report.

Thanks for the answer, even if it’s not the one I wanted. How about this: If I make page navigation “Top” then is there a way to add action buttons that only show if a particular page is active? So if page 2 shows my groups, could I have “All Groups” and “No Groups” buttons on top of form whose ShowIf formula refers to the page 2 being visible/active? If so, could you suggest a formula?

Will other page types l, such as Action, support action buttons?

Thanks…

Ron Mittelman

Hi Ron, you could try to use the “Show If” condition on the page level of your form, i.e. go to Visual > Forms > Select the form that has multiple pages > Go to the page you wish to show/hide > provide a condition in the “Show If” box.

The syntax for the ShowIf condition follows the standard syntax for our showif fields: Show If | Five | Low-Code For Real Developers

Thanks for the reply, Dom. It seems like you are answering my other question in the forum topic “Hide a sub-form page by parameter”. That is not yet possible until the “ShowIf” parameter is available.

The question I’m asking here would apply to the “ShowIf” parameter of an action button. Here is my use-case:

GenerateReports form has 3 pages, General, Groups and Portfolios. The latter 2 will be Join type pages. I really want a “Select All” button and a “Select None” button, so users don’t need to scroll through 100 groups and flip switches for every one. I would love to be able to have “Select All” and “Select None” on the top of 2nd and 3rd pages, but Action buttons only appear at the top of the form itself.

So either have 1 “Select All” and 1 “Select None” at the top of the form, and have the code behind them be sensitive to which page is active, OR have 2 sets of these buttons, with only 1 set visible if the Groups page is active and the other set visible if the Portfolios page is active. Either way could work, and I believe both methods must be aware of the active page, right?

So is there a way to determine which page of the form is currently active? I think it would require TOP navigation rather than CONTINUOUS navigation, but not really sure about that.

I hope I made my question clearer. Thanks again for replying.

I realize you folks are very busy getting new releases out, but if you could answer the one question, I could continue my training and development.

Is there a way to determine, via stack or context or whatever variables, which form page is active? If that is possible, I could make my action buttons work for the desired page. I presume this would only work if my pages used top navigation rather than continuous, but please correct me if I’m wrong. Thanks…

Hi Ron, we’re just testing this on our end. I will get back to you later today to see if your idea can be implemented.

Hi Ron, thanks for your patience! We just discussed this feature in our weekly product meeting. Currently this isn’t supported, but we have added it to our roadmap.

Thanks Dom. Appreciate the answer. I may have a way to accomplish what I want, but it requires an answer to a question:

I have a function to run on the server which I may call from different client functions. The calling function will create the context for the server function. Different calling functions may send different context variables.

So the question is, how do I in code determine a context field is undefined or missing? I want to do something like: If variable is missing, do this code else do that code. Thanks…

I may have figured this out, but not sure if it was in the most efficient manner.

I added 4 buttons to my Generate Reports form: ReportAllGroups, ReportNoGroups, ReportAllPortfolios and ReportNoPortfolios. These 4 buttons were necessary, since there is no way to have action buttons on the page level, just at the top of the form. If I could do it at the page level, I’d only need 2 buttons at the top of the Groups page and 2 at the top of the Portfolios page.

The ReportAllGroups button calls a function which calls the SetIsSelectedServer function, with a context of {Table: ‘StudyGroups’, IsSelected: true}. Same for ReportNoGroups, except send false in the context.

In SetIsSelectedServer, I put the following:

    if(context.IsSelected === true || context.IsSelected === false){
      five.log(context.IsSelected);
      let sql = 'UPDATE ' + context.Table + ' SET IsSelected = ' + context.IsSelected;
      let queryResults = five.executeQuery(sql, 0);//, myKey);
    }
    
    else{
     // here I do the code for initializing the table based on the join table. this works fine.
    }

This seems to work. If context variable IsSelected is true or false it marks every group as selected or unselected, and the DataView quickly refreshes appropriately.

If IsSelected is not true or false in the context (or missing entirely), the original code works fine. It first sets StudyGroups.IsSelected to false, then updates again to true based on a SQL against the StudyGroups table with INNER JOIN to the join table.

I’m not sure how efficient this is, but it does work.
Can you suggest a more efficient way to do this, or is this method just fine?

Thanks…

1 Like

Hi Ron,

I reckon this method and your code is just fine! Big thumbs up for finding a way to make this happen!:+1:t2:

Best

Dom