I have a strange problem with form wizard in conjunction with OSX style simplemodal dialog.
Steps to reproduce,
-
First time when i load the wizard, the form navigates fine to second step.
-
Close the wizard using close button (x)
-
Open the dialog again, and press Next.
It directly submits the form without going to next step.
-
First time when i load the wizard, the form navigates fine to second step.
-
Close the wizard using close button (x)
-
Open the dialog again, and press close again.
It throws javascript type error - uncaught type error for .find method in destroy method.
and the page hangs.
The problem only goes after reloading the page.
I have been banging my head over this for few days now. All i can figure out from Chrome javascript console is that this.element becomes undefined after closing the form first time.
Please help. Here's the code
$(document).ready(function () {
$("#addDeviceForm").formwizard({
formPluginEnabled: false,
validationEnabled: true,
focusFirstInput : true,
validationOptions:{
rules: {
imei:{
maxlength : 15,
minlength : 15
},
phone:{
number: true,
maxlength : 10,
minlength : 10
}
},
messages: {
imei:{
number: "Please enter valid number",
maxlength: "Please enter IMEI of 15 characters",
minlength: "Please enter IMEI of 15 characters"
},
phone:{
number: "Please enter valid number",
maxlength: "Please enter Phone number of 10 digits",
minlength: "Please enter Phone number of 10 digits"
}
}
},
disableUIStyles : true
});
});
HTML CODE
<div id="osx-modal-content" style="display: none">
<div id="osx-modal-title">Add a Device</div>
<div class="close">
<a href="#" class="simplemodal-close">x</a>
</div>
<div id="osx-modal-data">
<form id="addDeviceForm" onSubmit="return submitEnrollmentForm();"
class="bbq">
<div id="wizardHeader">
<span class="wizard button"><b>Step 1</b><small>Device
Basics</small></span> <span class="wizard buttonAction"><b>Step 2</b><small>Device
Details</small></span><span class="wizard buttonAction"><b>Step 3</b><small>Device
Details</small></span>
</div>
<div id="addDeviceSteps">
<fieldset class="step" id="first">
<dl style="height: 400px;">
<dt>
<label>User Name<span class="mandatory">*</span></label>
</dt>
<dd>
<input type="text" title="Enter user name" value="Enter user name" class="required"
name="userName" id="userName" autocomplete="on">
</dd>
<dt>
<label>Email Address<span class="mandatory">*</span></label>
</dt>
<dd>
<input type="text" title="Enter email" value="Enter email" class="required email"
name="email" id="email">
</dd>
<dt>
<label>Domain<span class="mandatory">*</span></label>
</dt>
<dd>
<input type="text" title="Enter Domain" value="Enter Domain" class="required"
id="domain" name="domain">
</dd>
<dt>
<label>Device Name<span class="mandatory">*</span></label>
</dt>
<dd>
<input type="text" title="Enter Device Name" value="Enter Device Name" id="deviceName"
name="deviceName" class="required">
</dd>
<dt>
<label>Personal Email Address</label>
</dt>
<dd>
<input type="text" title="" value="" class="email" name="personalEmail"
id="personalEmail">
</dd>
<dt>
<label>Phone Number<span class="mandatory">*</span></label>
</dt>
<dd>
<input style="width: 30px" type="text" title="91" value="91" maxlength="3"
class="required number" id="countrycode"> <input
type="text" id="phone" name="phone" title="Enter phone number" value="Enter phone number" maxlength="10"
style="width: 204px; margin: 0 0 0 10px"
class="required number">
</dd>
<dt>
<label>Ownership Details<span class="mandatory">*</span></label>
</dt>
<dd>
<select id="ownership" name="ownership" class="dropdown selectbox2" tabindex="3">
<option value="Corporate">Corporate</option>
<option value="Employee">Employee</option>
<option value="Shared">Shared</option>
</select>
</dd>
<div class="clear_both"></div>
<dt>
<label>Email Notification<span class="mandatory">*</span></label>
</dt>
<dd>
<select name="emailNotification" id="emailNotification"
class="dropdown selectbox2" tabindex="3">
<option value="User">User</option>
<option value="AdminUser">Admin & User</option>
</select>
</dd>
<div class="clear_both"></div>
<dt>
<label>Device OS<span class="mandatory">*</span></label>
</dt>
<dd>
<select id="platformType" name="state105"
class="dropdown selectbox2" tabindex="3">
<!-- <option value="">Select Device OS</option> -->
<c:forEach items="${platforms}" var="platform">
<option value='${platform.id}'>${platform.platformName}</option>
</c:forEach>
</select>
</dd>
<div class="clear_both"></div>
<dt></dt>
<dd><input type="checkbox" name="allowDevice" id="allowDevice"
style="width: 25px; margin: 0px 0px 0px 0px;">Only enroll devices from selected platform
</dd>
</dl>
</fieldset>
<fieldset class="step" id="second">
<dl style="width: 720px; height: 420px;">
<dt>
<label> Warranty Expiration Date</label>
</dt>
<dd>
<input type="text" title="DD/MM/YYYY" value="DD/MM/YYYY" class="calendar" size="10" maxlength="10"
id="warrantyExpDate" name="warrantyExpDate" readonly="readonly">
</dd>
<dt>
<label>Warranty Number</label>
</dt>
<dd>
<input type="text" title="Enter Warranty Number" value="Enter Warranty Number"
class="input_style_12" id="warrantyNumber"
name="warrantyNumber">
</dd>
<dt>
<label>Warranty Type</label>
</dt>
<dd>
<select id="warrantyType" name="warrantyType" class="dropdown selectbox2" tabindex="3">
<option value="-1" selected>Select Warranty Type</option>
<option value="M_Warranty">Manufacturer warranty</option>
<option value="S_Warranty">Seller warranty</option>
<option value="E_Warranty">Extended warranty</option>
</select>
</dd>
<div class="clear_both"></div>
<dt>
<label>Custom Asset Number</label>
</dt>
<dd>
<input type="text" title="Enter Custom Asset Number" value="Enter Custom Asset Number"
class="input_style_12" id="customAssetNo" name="customAssetNo">
</dd>
<dt>
<label>Purchase Date</label>
</dt>
<dd>
<input type="text" title="DD/MM/YYYY" value="DD/MM/YYYY" class="calendar" size="10" maxlength="10"
id="purchaseDate" name="purchaseDate" readonly="readonly">
</dd>
<dt>
<label> Purchase Order Number</label>
</dt>
<dd>
<input type="text" title="Enter Purchase Order Number" value="Enter Purchase Order Number"
class="input_style_12" id="purchaseOrderNo"
name="purchaseOrderNo">
</dd>
<dt>
<label>Purchase Price</label>
</dt>
<dd>
<input type="text" title="0.0" value="0.0" class="input_style_12 number"
id="purchasePrice" name="purchasePrice">
</dd>
<div class="clear_both"></div>
<dt>
<label> Purchase Type</label>
</dt>
<dd>
<select id="purchaseType" name="purchaseType" class="dropdown selectbox2" tabindex="3">
<option value="-1" selected>Select Purchase Type</option>
<option value="SinglePurchase">Single purchase</option>
<option value="VolumePurchase">Volume purchase</option>
</select>
</dd>
<div class="clear_both"></div>
<dt>
<label>Vendor</label>
</dt>
<dd>
<select id="vendorName" name="vendorName" class="dropdown selectbox2" tabindex="3">
<option value ="-1" selected>Select Vendor</option>
<option value="Apple">Apple</option>
<option value="Samsung">Samsung</option>
<option value="LG">LG</option>
<option value="Nokia">Nokia</option>
<option value="HTC">HTC</option>
<option value="Motorola">Motorola</option>
<option value="Blackberry">Blackberry</option>
</select>
</dd>
<div class="clear_both"></div>
<dt>
<label>Model/Device ID</label>
</dt>
<dd>
<input type="text" title="Enter Model/Device ID" value="Enter Model/Device ID"
class="input_style_12" id="deviceId" name="deviceId">
</dd>
<dt>
<label>IMEI</label>
</dt>
<dd>
<input type="text" value="" class="input_style_12" size="15" maxlength="15"
id="imei" name="imei">
</dd>
<div class="clear_both"></div>
<!-- <dt>
<label>Comments (Max 200 characters)</label>
</dt>
<dd>
<textarea class="" id="comments" name="comments" maxlength="200"></textarea>
</dd> -->
</dl>
</fieldset>
<!-- <fieldset class="step" id="third">
<div style="padding: 0 10px">
An enrollment request and registration instructions have been sent
to the registered Email Address and phone number.<br />
<br /> The device can also be registered by accessing the below
URL from the device.<br />
<br /> URL:http://services.kony.com/mdm
</div>
</fieldset> -->
</div>
<div id="formFooter">
<dt>
<input class="navigation_button buttonControl" id="back"
value="Back" type="reset" hidden="true"/>
</dt>
<dd>
<input class="navigation_button buttonControl" id="next"
value="Submit" type="submit" />
</div>
</dd>
</dl>
</form>
</div>
</div>
Please note this is used in conjection with OSX simplemodal dialog jquery plugin.