From be252ff87e71383bea46bb65365a1cecf194e306 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Wed, 14 May 2014 12:12:59 +0200 Subject: [PATCH] Form available check --- js/ConnectingToNetworkPage.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/js/ConnectingToNetworkPage.js b/js/ConnectingToNetworkPage.js index 14bfa6a..b9f3547 100644 --- a/js/ConnectingToNetworkPage.js +++ b/js/ConnectingToNetworkPage.js @@ -38,15 +38,14 @@ $.mobile.document.on( "pagebeforeshow", PAGE_ID, function( event, data ) { console.log("Connecting to network page pagebeforeshow"); _pageData = d3d.util.getPageParams(PAGE_ID); - if(_pageData === undefined) { + var form = data.prevPage.find("form"); + // check if there are url params and a form from a prev page + if(_pageData === undefined || form.length === 0) { $.mobile.changePage("#boxes"); return; } var boxURL = "http://"+_pageData.localip; - - var form = data.prevPage.find("form"); _formData = d3d.util.getFormData(form); - _infoAPI.init(boxURL); _networkAPI.init(boxURL); retrieveWiFiBoxID(function() {