Pure ASP Upload 3 Support Product Page
Spry not working... I've tried the suggestions in other threads...
Asked 05 Jan 2010 23:34:26
1
has this question
05 Jan 2010 23:34:26 Greg Gernhart posted:
I am trying to use Pure ASP Upload 3 and have some sort of form validation with it. I tried using spry validation and then changing the validation to use Change. I cannot get the validation to work. Any advice? Replies
Replied 05 Jan 2010 23:57:46
05 Jan 2010 23:57:46 Greg Gernhart replied:
Here is my code if that will help anyone help me with a solution.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script src="../../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script> <script language="Javascript"> <!-- function changeRow() { var intCount = document.getElementById("printOptions").options.length; //gets count of items in select menu var intValue = document.getElementById("printOptions").selectedIndex; //gets number (0 index) of selected item for (i=0;i<intCount;i++){ var strValue = document.getElementById("printOptions")[i].value; //gets value of selected item if (i == intValue) { document.getElementById(strValue).style.display=''; } else { document.getElementById(strValue).style.display='none'; } } } //--> </script> <script type="text/javascript"><%=pau.generateScriptCode()%></script> <script src="../../ScriptLibrary/incPU3.js" type="text/javascript"></script> <link href="../../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" /> </head> <body> <form ACTION="<%=MM_editAction%>" METHOD="post" enctype="multipart/form-data" name="form1" id="form1" onSubmit="<%=pau.submitCode()%>;return document.MM_returnValue"> <table width="100%" border="0"> <tr> <td width="18%">Name:</td> <td width="82%"><input type="text" name="fullName" id="fullName" value="<%Response.Write(Session("givenName"))%><%Response.Write(" " & Session("sn"))%>"/> <span id="sprytextfield1"> <label>test <input type="text" name="text1" id="text1" /> </label> <span class="textfieldRequiredMsg">A value is required.</span></span></td> </tr> <tr> <td>Department:</td> <td><select name="department" id="department"> <option value=""></option> <option value="Administration">Administration</option> <option value="Bussiness Department">Business Department</option> <option value="Health Science Department">Health Science Department</option> <option value="Industrial Technology Department">Industrial Technology Department</option> <option value="LAH Department">LAH Department</option> <option value="Math/Science Department">Math/Science Department</option> <option value="Transportation">Transportation</option> </select></td> </tr> <tr> <td>Phone Extension:</td> <td><input type="text" name="phone" id="phone" value="<%Response.Write(Session("telephonenumber"))%>"/></td> </tr> <tr> <td>Date Submitted:</td> <td><%=(Now)%> <input name="dateSubmitted" type="hidden" value="<%=(Now)%>" /></td> </tr> <tr> <td>Date Needed:</td> <td><input type="text" name="dateNeeded" id="dateNeeded" value="<%=DateAdd("d",3,(FormatDateTime(Now,2)))%>"/></td> </tr> <tr> <td>Time Needed:</td> <td><select name="timeNeeded" id="timeNeeded"> <option value=""></option> <option value="8:00am">8:00am</option> <option value="9:00am">9:00am</option> <option value="10:00am">10:00am</option> <option value="11:00am">11:00am</option> <option value="12:00pm">12:00pm</option> <option value="1:00pm">1:00pm</option> <option value="2:00pm">2:00pm</option> <option value="3:00pm">3:00pm</option> <option value="4:00pm">4:00pm</option> </select></td> </tr> <tr> <td>Delivery Destination:</td> <td><select name="deliveryLocation" id="deliveryLocation"> <option value=""></option> <option value="Pick-Up" selected="selected">Pick-Up</option> <option value="Admin Building">Admin Building</option> <option value="AST Building">AST Building</option> <option value="BHS Building">BHS Building</option> <option value="Library">Library</option> <option value="Science Building">Science Building</option> </select></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Page Count in document(s):</td> <td><input name="pageCount" type="text" id="pageCount" size="3" maxlength="3" /></td> </tr> <tr> <td># of Copies:</td> <td><input name="copies" type="text" id="copies" size="3" maxlength="2" /></td> </tr> <tr> <td colspan="2">Description:<br /> <textarea name="desc" id="desc" cols="45" rows="5"></textarea></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Sold in Bookstore:</td> <td><select name="bookstore" id="bookstore"> <option value=""></option> <option value="No" selected="selected">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>To be Billed:</td> <td><select name="billed" id="billed"> <option value=""></option> <option value="No" selected="selected">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>Billing Number:</td> <td><input type="text" name="billingNum" id="billingNum" /></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td valign="top">Attach Document 1 to be Copied:<br /> (Must be 25MB or less)</td> <td valign="top"><input name="fileField" type="file" id="fileField" onChange="<%=uploadfileField.validateCode()%>;return document.MM_returnValue"/></td> </tr> <tr> <td valign="top">Attach Document 2 to be Copied:<br /> (Must be 25MB or less)</td> <td valign="top"><input name="fileField2" type="file" id="fileField2" onChange="<%=uploadfileField2.validateCode()%>;return document.MM_returnValue" /></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td colspan="2"><table id="tbTable" cellpadding="2" cellspacing="2" border="0"> <tr> <td>Print Options: </td> <td><select id="printOptions" onChange="changeRow();" name="printOptions"> <option value="Most Cost Effective" selected="selected">Most Cost Effective (Copy Center Choice)</option> <option value="Double Sided">Double Sided</option> <option value="Booklet">Booklet 11x17</option> <option value="Single Sided">Single Sided</option> </select></td> <td></td> </tr> <tr id="Most Cost Effective" style="display:none;"> <td> </td> <td> </td> <td> </td> </tr> <tr id="Double Sided" style="display:none;"> <td colspan="3"><table width="100%" border="0"> <tr> <td width="25%">Staple:</td> <td width="75%"><select name="staple" id="staple"> <option value="No" selected="selected">No</option> <option value="1 Staple">1 Staple</option> <option value="2 Staple">2 Staple</option> </select></td> </tr> <tr> <td>Collate:</td> <td><select name="collate" id="collate"> <option value="No" selected="selected">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>Group:</td> <td><select name="group" id="group"> <option value="No" selected="selected">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>3 Hole Punch:</td> <td><select name="3HolePunch" id="3HolePunch"> <option value="No" selected="selected">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>Padded:</td> <td><select name="padded" id="padded"> <option value="No" selected="selected">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>Powerpoint:</td> <td><select name="powerpoint" id="powerpoint"> <option value="No" selected="selected">No</option> <option value="9 Slides Per Page">9 Slides Per Page</option> <option value="6 Slides Per Page">6 Slides Per Page</option> <option value="3 Slides Per Page">3 Slides Per Page</option> </select></td> </tr> <tr> <td>Cut:</td> <td><select name="cut" id="cut"> <option value="No" selected="selected">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>Paper Color:</td> <td><select name="paperColor" id="paperColor"> <option value="White" selected="selected">White</option> <option value="Borealis Blue">Borealis Blue</option> <option value="Buff">Buff</option> <option value="Gray">Gray</option> <option value="Ivory">Ivory</option> <option value="Lt. Blue">Lt. Blue</option> <option value="Lt. Green">Lt. Green</option> <option value="Lt. Pink">Lt.Pink</option> <option value="Lt. Yellow">Lt. Yellow</option> <option value="Orchid">Orchid</option> <option value="Pumpkin">Pumpkin</option> <option value="Purple">Purple</option> <option value="Red">Red</option> <option value="Salmon">Salmon</option> <option value="Tan">Tan</option> <option value="Teal">Teal</option> <option value="Xmas Green">Xmas Green</option> <option value="Energetic Orange">Energetic Orange</option> <option value="Flaring Fuchsia">Flaring Fuchsia</option> <option value="Luminous Lime">Luminous Lime</option> <option value="Sunshine Yellow">Sunshine Yellow</option> </select></td> </tr> <tr> <td>Cover Color:</td> <td><select name="coverColor" id="coverColor"> <option value="No Cover" selected="selected">No Cover</option> <option value="White">White</option> <option value="Letterhead">Letterhead</option> <option value="Borealis Blue">Borealis Blue</option> <option value="Buff">Buff</option> <option value="Energetic Orange">Energetic Orange</option> <option value="Flaring Fuchsia">Flaring Fuchsia</option> <option value="Gray">Gray</option> <option value="Ivory">Ivory</option> <option value="Lt. Blue">Lt. Blue</option> <option value="Lt. Green">Lt. Green</option> <option value="Lt. Pink">Lt.Pink</option> <option value="Lt. Yellow">Lt. Yellow</option> <option value="Luminous Lime">Luminous Lime</option> <option value="Orchid">Orchid</option> <option value="Pumpkin">Pumpkin</option> <option value="Purple">Purple</option> <option value="Red">Red</option> <option value="Salmon">Salmon</option> <option value="Sunshine Yellow">Sunshine Yellow</option> <option value="Tan">Tan</option> <option value="Teal">Teal</option> <option value="Xmas Green">Xmas Green</option> </select></td> </tr> </table></td> </tr> <tr id="Booklet" style="display:none;"> <td colspan="3"><table width="100%" border="0"> <tr> <td width="25%">Powerpoint:</td> <td width="75%"><select name="powerpoint2" id="powerpoint2"> <option value="No" selected="selected">No</option> <option value="9 Slides Per Page">9 Slides Per Page</option> <option value="6 Slides Per Page">6 Slides Per Page</option> <option value="3 Slides Per Page">3 Slides Per Page</option> </select></td> </tr> <tr> <td>Paper Color:</td> <td><select name="BookletColor" id="BookletColor"> <option value="White" selected="selected">White</option> <option value="Buff">Buff</option> <option value="Energetic Orange">Energetic Orange</option> <option value="Gold">Gold</option> <option value="Gray">Gray</option> <option value="Lt. Blue">Lt. Blue</option> <option value="Lt. Green">Lt. Green</option> <option value="Lt. Pink">Lt. Pink</option> <option value="Luminous Lime">Luminous Lime</option> <option value="Moss">Moss</option> <option value="Orchid">Orchid</option> <option value="Pine">Pine</option> <option value="Salmon">Salmon</option> <option value="Sunshie Yellow">Sunshine Yellow</option> <option value="Tan">Tan</option> <option value="Triton Blue">Triton Blue</option> </select></td> </tr> <tr> <td>Cover Color:</td> <td><select name="coverColor2" id="coverColor2"> <option value="No Cover" selected="selected">No Cover</option> <option value="White">White</option> <option value="Borealis Blue">Borealis Blue</option> <option value="Buff">Buff</option> <option value="Energetic Orange">Energetic Orange</option> <option value="Flaring Fuchsia">Flaring Fuchsia</option> <option value="Gray">Gray</option> <option value="Ivory">Ivory</option> <option value="Lt. Blue">Lt. Blue</option> <option value="Lt. Green">Lt. Green</option> <option value="Lt. Pink">Lt.Pink</option> <option value="Lt. Yellow">Lt. Yellow</option> <option value="Luminous Lime">Luminous Lime</option> <option value="Orchid">Orchid</option> <option value="Pumpkin">Pumpkin</option> <option value="Purple">Purple</option> <option value="Red">Red</option> <option value="Salmon">Salmon</option> <option value="Sunshine Yellow">Sunshine Yellow</option> <option value="Tan">Tan</option> <option value="Teal">Teal</option> <option value="Xmas Green">Xmas Green</option> </select></td> </tr> </table></td> </tr> <tr id="Single Sided" style="display:none;"> <td colspan="3"><table width="100%" border="0"> <tr> <td width="25%">Staple:</td> <td width="75%"><select name="staple2" id="staple2"> <option value="No" selected="selected">No</option> <option value="1 Staple">1 Staple</option> <option value="2 Staple">2 Staple</option> </select></td> </tr> <tr> <td>Collate:</td> <td><select name="collate2" id="collate2"> <option value="No" selected="selected">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>Group:</td> <td><select name="group2" id="group2"> <option value="No" selected="selected">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>3 Hole Punch:</td> <td><select name="3HolePunch2" id="3HolePunch2"> <option value="No" selected="selected">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>Folded:</td> <td><select name="folded" id="folded"> <option value="No" selected="selected">No</option> <option value="Half">Half</option> <option value="Thirds">Thirds</option> </select></td> </tr> <tr> <td>Padded:</td> <td><select name="padded2" id="padded2"> <option value="No" selected="selected">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>Cut:</td> <td><select name="cut2" id="cut2"> <option value="No" selected="selected">No</option> <option value="Yes">Yes</option> </select></td> </tr> <tr> <td>Paper Color:</td> <td><select name="paperColor3" id="paperColor3"> <option value="White" selected="selected">White</option> <option value="Borealis Blue">Borealis Blue</option> <option value="Buff">Buff</option> <option value="Energetic Orange">Energetic Orange</option> <option value="Flaring Fuchsia">Flaring Fuchsia</option> <option value="Gray">Gray</option> <option value="Ivory">Ivory</option> <option value="Lt. Blue">Lt. Blue</option> <option value="Lt. Green">Lt. Green</option> <option value="Lt. Pink">Lt.Pink</option> <option value="Lt. Yellow">Lt. Yellow</option> <option value="Luminous Lime">Luminous Lime</option> <option value="Orchid">Orchid</option> <option value="Pumpkin">Pumpkin</option> <option value="Purple">Purple</option> <option value="Red">Red</option> <option value="Salmon">Salmon</option> <option value="Sunshine Yellow">Sunshine Yellow</option> <option value="Tan">Tan</option> <option value="Teal">Teal</option> <option value="Xmas Green">Xmas Green</option> </select></td> </tr> <tr> <td>Cover Color:</td> <td><select name="coverColor3" id="coverColor3"> <option value="No Cover" selected="selected">No Cover</option> <option value="White">White</option> <option value="Letterhead">Letterhead</option> <option value="Borealis Blue">Borealis Blue</option> <option value="Buff">Buff</option> <option value="Energetic Orange">Energetic Orange</option> <option value="Flaring Fuchsia">Flaring Fuchsia</option> <option value="Gray">Gray</option> <option value="Ivory">Ivory</option> <option value="Lt. Blue">Lt. Blue</option> <option value="Lt. Green">Lt. Green</option> <option value="Lt. Pink">Lt.Pink</option> <option value="Lt. Yellow">Lt. Yellow</option> <option value="Luminous Lime">Luminous Lime</option> <option value="Orchid">Orchid</option> <option value="Pumpkin">Pumpkin</option> <option value="Purple">Purple</option> <option value="Red">Red</option> <option value="Salmon">Salmon</option> <option value="Sunshine Yellow">Sunshine Yellow</option> <option value="Tan">Tan</option> <option value="Teal">Teal</option> <option value="Xmas Green">Xmas Green</option> </select></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td colspan="2">Special Instructions:<br /> <textarea name="specialInstructions" id="specialInstructions" cols="45" rows="5"></textarea></td> </tr> <tr> <td><input type="submit" name="button" id="button" value="Submit" /></td> <td> </td> </tr> </table> <input type="hidden" name="MM_insert" value="form1" /> </form> <script type="text/javascript"> <!-- var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["change"]}); //--> </script> </body> </html>
Replied 12 Jan 2010 15:39:59
12 Jan 2010 15:39:59 Ian Webb replied:
Hi Greg!
I've had this problem. What's happening is that the PAU onSubmit code is overriding the Spry validation call. Change the Form onsubmit from:
onSubmit="<%=pau.submitCode()%>;return document.MM_returnValue">
to:
onsubmit="if (Spry.Widget.Form.validate(this)) {<%=pau.submitCode()%>;return document.MM_returnValue} else return false;"
Basically, it says 'if the form's valid, run the upload code, otherwise return false (which cancels the submit).
Cheers, Ian.
I've had this problem. What's happening is that the PAU onSubmit code is overriding the Spry validation call. Change the Form onsubmit from:
onSubmit="<%=pau.submitCode()%>;return document.MM_returnValue">
to:
onsubmit="if (Spry.Widget.Form.validate(this)) {<%=pau.submitCode()%>;return document.MM_returnValue} else return false;"
Basically, it says 'if the form's valid, run the upload code, otherwise return false (which cancels the submit).
Cheers, Ian.
Replied 13 Jan 2010 21:27:49
13 Jan 2010 21:27:49 Greg Gernhart replied:
Thanks Ian! That worked perfectly.