Hi Fellow AppStudio Users,
I have recently been developing a quick report application for a post-doctoral researcher who wanted just the landing page and map page from which you could submit the sighting. I knew this was possible, but was not aware of how to properly move the "Save" and "Submit" buttons. I did some tinkering with the code and found that there is already some code implemented into the RefineLocation.qml page that can be used to submit the report. I haven't been able to get the "isOnline" feature working yet, but this can potentially be processed in a future version of the application. If anyone has any suggestions for implementing this feature with what I already have, please feel free to post in the comments.
Anyways, I'll go ahead and start with structure for the QuickReportApp.qml page. To create an application that only displays the landing page and RefineLocation page, scroll down to approximately line 2071 (refineLocationPage component) and implement the code from the addDetailsPage component to the refineLocationPage. Note that my app did not handle any attachments, so it automatically switched to the refineLocation page upon hitting "New" on the landingPage. If you are wanting to handle attachments, you may have to change the the logic in this area of the QuickReportApp to switch to the appropriate page upon clicking next on the addPhotoPage. The logic is handled by the stackView.XYZPage, where XYZ is the page that you are wanting to switch to.
Now that the refineLocationPage is handling the "submit" message, we can go to the addDetails page and copy the code for the Save and Submit buttons to paste in place of the "Next" button on the refineLocation page, approximately line 1380. NOTE: do not replace the code for the "MouseArea" function. Format the buttons to what is necessary for your app and then review the code. You will see the nextPage( ); function in the MouseArea, this is where we will handle the save request. Scroll to approximately line 1485 to the nextPage( ) function. Leave the code the way it is, but insert "save" at the bottom of the function within the next( ); code. I then copied and pasted this same code (either above or below, it doesn't matter) and renamed the function nextPageSubmit ( ) and inserted "submit" in the bottom next( ) code. This should allow you to submit your sightings from the refineLocation page instead of the addDetailsPage.
Please feel free to provide suggestions if there is a more elegant design that I may have missed. In the meantime, this has seemed to work well for the current version of my application.
Dustin Baumbach, PhD
It seems like you have figured out a way to do the customization you wanted to do. Ideally, all of 4 or 5 pages in QuickReport can be on one page if we put all the code in one QML file and remove the logic to go next and back on the page. So, yes, what you are doing seems valid to me.
The release of Quick Report 5.1 has broken this code structure. I tried to update the app I created (iSeaTurtle) to quick report 5.1 using the above code structure and am getting an error upon clicking the submit button. Can you please suggest an alternative to correct this issue and have the submit button work correctly when placed on the RefineLocationPage?
I have added screenshots of my modified code from the quick report 5.1 for your convenience. Let me know if you would like any other resources to help solve this issue.
We apologize that you are having an issue with Quick Report 5.1 template. Is the out of the box Quick Report 5.1 template working (submitting a new feature) against this feature layer?
We make updates to the template at every release to keep up with new features and bug fixes, and sometimes the customization that you did in the previous version can not be simply "copied-pasted" over. It might require some adjustment with the new code. If you help us point out how your custom code works and where exactly it is throwing an error (and what the error messages are) and we could probably help.
Did you do the customization? I think the developer who did the customization is the best person to help with this.
Yes, I was the one who customized the original application. I was basing my original code off of the structure in the AddDetailsPage in a 4.X version of AppStudio (I can't remember which specific build at the moment). The out of the box version was confirmed to be working, but then broke once I placed the submit button on the RefineLocationPage.
Specifically, I copied and pasted the submitBtn code from the AddDetailsPage to the RefineLocationPage and then replaced the "next" message within the OnClicked function to refer to the processInput function (i.e. processInput();) (see screen shots 1 & 2 above). I then placed a next message ("next("submit")") at the bottom of the processInput function. This is what was previously working for me, but now makes the submit button fail. I have attached a screen shot of the error message once the submit button is clicked. Please advise.
So it sounds like the issue is in the custom code, I can't make out what's wrong from the information that you have provided. I would suggest trying to debug your custom code and see what is going on. Here's the debugging video we made using Qt Creator, https://youtu.be/FzZd3eGc1jA?t=36 or you can also print the console log messages.
I watched the video you sent. The problem is that I'm not getting an AppStudio error, just an error on the feature service side when I try to submit my point. I sent you an e-mail with my project code so you can take a look at what I have done in more detail. Please let me know if you have any advice for how I can fix my code to make the submit button work properly. I am unsure if I've not connected something correctly, or if it is my feature service. Let me know what you see once you have been able to take a look at my code. Thanks!
Hi @ErwinSoekianto. Thanks for sending the debug tool. I guess to boil everything down, I’m looking for the best way to correctly move the submit button to another page. If you could provide the basic framework, or an example/sample, I think I could do the problem-solving from there. Thanks so much for all of your help with this.