Tagged: MBS
This topic contains 5 replies, has 2 voices, and was last updated by admin 7 years, 6 months ago.
-
AuthorPosts
-
May 23, 2017 at 4:29 pm #73938
Hi,
Is there a way of using the MBS plugin to go to a date and view.
I would like to call it from a script, this would stop the webview from having to refresh or be reloaded.
If so could you please show an example of the code I would need.
Craig
-
May 23, 2017 at 5:10 pm #73939
You don’t need MBS to get the date & view – that’s available in the URL of the web viewer.
Use the following FileMaker function.
getlayoutobject($$calendar_object;”source”)
More info here:
http://www.sosimplesoftware.com/forums/topic/hash-vs-date-shown-on-calendar/
-
May 23, 2017 at 5:21 pm #73940
Morning Ken
My solution I am building has the option to add a follow-up appointment for the client.
So when you open the event I have a button bar with 1, 2, 3, 4 representing how many weeks in the future the follow-up appointment is needed.
when the user clicks let’s say 2 it creates a new event and I would like to take the user to that day, so the user can set the correct time.
In your option what is the best way of doing this? Is there a way without the webview flashing when reloading the change of date?
Craig
-
May 23, 2017 at 5:46 pm #73941
The easiest way to navigate to the new date is to change the URL to reflect the new date (see http://www.sosimplesoftware.com/products/calendar-documentation/calendar-builder-reference/adjusting-your-calendar/url-anchors-for-date-and-view-links/). There’s no need for MBS or JavaScript.
To navigate the calendar using MBS, you can send this JavaScript to your webviewer:
scheduler.setCurrentView(new Date(2017,7,4));
See MBS documentation on how to do this:
-
May 24, 2017 at 5:36 am #73942
Hi Ken,
Thanks for the sample code.
We I use this I am going 1 full month ahead, I can not work out why.
I set up a workaround by ~_month -1
I have set up a test with the following:
Date = 19/12/2017
Custom function to pass the date into the correct format =
dateForScheduler (theDate)
Let([
~_month =Month (theDate);
~_day = Day(theDate );
~_year = Year(theDate )
];
~_year & “,” & ~_month & “,” & ~_day
)
then set a veriable = MBS(“WebView.RunJavaScript”; “web_calendar”; “scheduler.setCurrentView(new Date(” & dateForScheduler ( Date ) & “));”)
Any advice would be very helpful
Craig
- This reply was modified 7 years, 6 months ago by kiwioz.
-
May 24, 2017 at 9:59 am #73945
Your “workaround” is fine. JavaScript date function uses zero-based months, so new Date (2017, 0 , 5) is Jan 5.
-
AuthorPosts
You must be logged in to reply to this topic.