jackcroww[ at ]gmail.com wrote:
[Quoted Text] > I have a form that my users want to be able to use while offline. I > have set up the form so that I have two buttons at the bottom of the > form, one of which submits the form via email [EmailSubmit], and the > other submits the form directly to a Sharepoint site [WebSubmit]. > > I know that I can determine the Online/Offline state in the OnLoad > event with Application.MachineOnlineState: > > <code> > function XDocument::OnLoad(eventObj) > { > if (Application.MachineOnlineState) > XDocument.UI.Alert("Online"); > else > XDocument.UI.Alert("Offline"); > } > </code> > > But, there is where I'm stuck with two problems. > > 1. As far as I can tell, the Application.MachineOnlineState only > determines if the user is on a network. Ideally, I'd like my test to > look for my specific Sharepoint site and verify it is available. > > 2. I seem to have found that one can't access the form elements > programmatically, so it there a way to get my Online/Offline test > result available to the Conditional Formatting capability? > > Thanks in advance for any help. > > Jack
Solved it:
Added this code to script.js
<code> function IsServerAvailable() { if (Application.IsDestinationReachable("http://mmci-gd103sp1")) return true; else return false; } </code>
Then added these Conditional Formatting expressions to the appropriate buttons:
WebSubmit: [xdExtension:IsServerAvailable() = false] : Hide this control EmailSubmit: [xdExtension:IsServerAvailable()] : Hide this control
Hope this helps anyone else with this problem.
|