AlanJCraven Posted May 11, 2018 Share Posted May 11, 2018 We are fairly new to Froglearn and are currently building our parent portal. I would like to use the date selection widget along with the MIS linked documents widget but I would like to prefill the date selection widget so that the default is to display all linked documents for this academic year. Is this possible? Has anyone tried this before? Any suggestions gratefully accepted. Thanks Alan Link to comment Share on other sites More sharing options...
adamw Posted May 11, 2018 Share Posted May 11, 2018 5 hours ago, AlanJCraven said: We are fairly new to Froglearn and are currently building our parent portal. I would like to use the date selection widget along with the MIS linked documents widget but I would like to prefill the date selection widget so that the default is to display all linked documents for this academic year. Is this possible? Has anyone tried this before? Any suggestions gratefully accepted. Thanks Alan Hey Alan, I put together a little snippit of code that might do what you want. You'd need to add this to a HTML widget and put it on the same page as your Linked Documents widget. It won't change the dates on the select date widget, but it will broadcast a new set of dates to the system, which the linked documents widget should pick up on and act upon. I've not had time to test it, so (disclaimer) it may not work at all! <script type="text/javascript"> setTimeout(function(){ var prefs = { 'associations': { 'type': 'associations', 'label': 'Widget Collections', 'value': JSON.stringify({ 'associations': [], 'publisher': true, 'subscriber': false }) } }, sept, end = moment().valueOf(); var year = moment().format("Y"); var month = moment().format("M"); if (month < 9) { year -= 1; } var date_string = "01-09-" + year; sept = moment(date_string).valueOf(); var controller = new Frog.Widget.Controller($.find(".widget_html"), {}, {prefs: prefs}); controller.broadcast('selectedInterval', new Broadcast.Models.Interval({ startTime: sept, endTime: end })); }, 1000); </script> If you don't have the HTML widget on your Frog platform then speak to the service desk and they can enable it for you. If you have any problems let either me or @Graham Quince know. Hopefully it'll just work though 1 Link to comment Share on other sites More sharing options...
Graham Quince Posted May 12, 2018 Share Posted May 12, 2018 nice one Adam. I’m sure lots of schools will use this Link to comment Share on other sites More sharing options...
AlanJCraven Posted May 14, 2018 Author Share Posted May 14, 2018 Many thanks Adam. I have tried the snippit of code and initial results are great. This will save lots of phone calls from parents who can't see the reports because they haven't filled in the selection dates. Alan 1 Link to comment Share on other sites More sharing options...
AlanJCraven Posted May 15, 2018 Author Share Posted May 15, 2018 Hi Adam, I have been playing with the code and I think the date format at line 24 is in the US format i.e. mm-dd-yyyy as I was getting a few more records than I expected. I have changed it to the following var date_string = "09-01-" + year; sept = moment(date_string).valueOf(); This seems to work fine. Thanks for your efforts. Alan 1 Link to comment Share on other sites More sharing options...
adamw Posted May 15, 2018 Share Posted May 15, 2018 8 hours ago, AlanJCraven said: Hi Adam, I have been playing with the code and I think the date format at line 24 is in the US format i.e. mm-dd-yyyy as I was getting a few more records than I expected. I have changed it to the following var date_string = "09-01-" + year; sept = moment(date_string).valueOf(); This seems to work fine. Thanks for your efforts. Alan Glad it's working for you Link to comment Share on other sites More sharing options...
pdurber Posted January 12, 2020 Share Posted January 12, 2020 Thank you. Works a treat for us. Like you said, I hope this stops the tide of Parental phone calls/emails... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now