Universal Form Validator ASP Support Product Page
redirect on validate
Asked 29 Jan 2013 04:22:35
5
have this question
29 Jan 2013 04:22:35 Bart Garner posted:
When you add Universal Form Validator to a page it changes the form action to: <%=DMX_validateAction%>Typically I process forms to another page. I always just change this: <%=DMX_validateAction%> back to the page name that I want to direct the user to for processing and it works just fine.
Just now I did this with two forms with no problem but when I did it to a third form, it simply will not validate unless the form action is <%=DMX_validateAction%>.
I'm hunting for differences between this page and the two I did earlier but if it is there, it is very obscure.
How can I accomplish this?
1. Validate the form
2. Redirect
In this case I am working with ASP, but I have the same issue in PHP, although I have never had one fail in this manner.
Replies
Replied 29 Jan 2013 05:01:45
29 Jan 2013 05:01:45 Bart Garner replied:
On this same form, the mask for the phone number is ignored and every time I run the extension, when I save it I get the errors: "Making this change would require changing code that is locked by a translator" and then "While executing onLoad, the following javascripts occurred: At line 468 of ....dmxUdateHead.htm The object is not currently contained in a document"
[html]
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="ScriptLibrary/dmxValidator.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")
If (Request.QueryString <> "" Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' Universal Form Validator ASP 1.5.6
dim dmxval1, DMX_validateAction
set dmxval1 = new dmxValidator
dmxval1.ScriptFolder = "ScriptLibrary"
dmxval1.CSValidateOnChange = true
dmxval1.CSValidateOnSubmit = true
dmxval1.ReenableJavascript = true
dmxval1.UseBotCheck = true
dmxval1.ReportType = 4
dmxval1.ErrorFont = "Arial"
dmxval1.ErrorFontSize = 12
dmxval1.ErrorColor = "#ffffff"
dmxval1.ErrorBgColor = "#ff0000"
dmxval1.ErrorBold = true
dmxval1.ErrorItalic = false
dmxval1.ErrorImage = ""
dmxval1.ErrorFixed = "Custom"
dmxval1.ErrorPadding = 4
dmxval1.BorderColor = "#FF0000"
dmxval1.CssErrorFile = "validatorError7"
dmxval1.ErrorPreset = "error_five.txt"
dmxval1.TooltipPosition = "top"
dmxval1.CssHintFile = "validatorHint7"
dmxval1.HintPreset = "blue.txt"
dmxval1.HintTooltipPosition = "top"
dmxval1.HintBorderColor = "#0099ff"
dmxval1.HintBorderStyle = "solid"
dmxval1.HintBgColor = "#003399"
dmxval1.HintTextColor = "#ffffff"
dmxval1.HintTextFont = "Arial"
dmxval1.HintTextSize = 12
dmxval1.HintTextBold = false
dmxval1.HintTextItalic = false
dmxval1.HintBoxWidth = 200
dmxval1.HintImage = ""
dmxval1.HintFixed = "Custom"
dmxval1.HintPadding = 4
dmxval1.UseCustomFocusClass = "fixed"
dmxval1.FocusBorderStyle = "groove"
dmxval1.FocusBorderSize = 2
dmxval1.FocusBorderColor = "#C3D9FF"
dmxval1.FocusBgColor = "#FFFFFF"
dmxval1.FocusTextColor = "#000000"
dmxval1.UseCustomValidClass = "fixed"
dmxval1.ValidBorderStyle = "groove"
dmxval1.ValidBorderSize = 2
dmxval1.ValidBorderColor = "#00FF00"
dmxval1.ValidBgColor = "#FFFFFF"
dmxval1.ValidTextColor = "#000000"
dmxval1.UseCustomInvalidClass = "fixed"
dmxval1.InvalidBorderStyle = "groove"
dmxval1.InvalidBorderSize = 2
dmxval1.InvalidBorderColor = "#FF0000"
dmxval1.InvalidBgColor = "#FFFFFF"
dmxval1.InvalidTextColor = "#000000"
dmxval1.AddRule "form1", "agree", "allformats", ",,", "true", "", "", "", ""
dmxval1.AddRule "form1", "name", "disallowedcond", "://,,", "true", "Mandatory Field. No links allowed.", "", "", ""
dmxval1.AddRule "form1", "phone", "allformats", ",,", "true", "", "", "", ""
dmxval1.AddRule "form1", "email", "emailcond", ",,", "true", "", "", "", ""
dmxval1.AddRule "form1", "comments", "disallowedcond", "://,,", "false", "Sorry, no links allowed.", "", "", ""
dmxval1.AddRule "form1", "subject", "allformats", ",,", "true", "", "", "", ""
dmxval1.AddMask "form1", "phone", "phone", "North America"
dmxval1.Validate
%>
[/html]
[html]
<form action="<%=DMX_validateAction%>" method="post" name="form1" id="form1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><h2 class="employmentheader">NOTE: Content REmoved. [/h2]
<p><strong>Please acknowledge your understanding of this policy by clicking the box below.</strong></p>
<p>
<label>
<input type="checkbox" name="agree" id="agree" />
</label>
<%= dmxval1.GenerateError("form1","agree","allformats",",," %> Content removed </p></td>
</tr>
<tr>
<td width="30%">Name</td>
<td width="70%"><label>
<input name="name" type="text" id="name" value="<%= dmxSetValue("", FormRequest("name") %>" />
</label>
<%= dmxval1.GenerateError("form1","name","disallowedcond","://,," %> * Mandatory </td>
</tr>
<tr>
<td>Phone</td>
<td><label>
<input name="phone" type="text" id="phone" value="<%= dmxSetValue("", FormRequest("phone") %>" />
</label>
<%= dmxval1.GenerateError("form1","phone","allformats",",," %></td>
</tr>
<tr>
<td>Email</td>
<td><input name="email" type="text" id="email" value="<%= dmxSetValue("", FormRequest("email") %>" />
<%= dmxval1.GenerateError("form1","email","emailcond",",," %>
<label> </label>
* Mandatory </td>
</tr>
<tr>
<td>Job Hunting?</td>
<td><p>
<label>
<input name="jobhunting" type="radio" id="jobhunting_2" value="no" checked="checked" <%= dmxSetRadio("no",FormRequest("jobhunting") %> />
No</label>
- If yes <a href="job-search.asp">Go HERE</a><br />
</p></td>
</tr>
<tr>
<td>Subject</td>
<td><label>
<select name="subject" id="subject">
<option value="" selected="selected">Must Choose One</option>
<option <%= dmxSetSelectOption("website",FormRequest("subject",false) %> value="website">Question about Website</option>
<option <%= dmxSetSelectOption("retirement homes",FormRequest("subject",false) %> value="retirement homes">Question about Retirement Living</option>
<option <%= dmxSetSelectOption("resources",FormRequest("subject",false) %> value="resources">Question about Resources</option>
<option <%= dmxSetSelectOption("articles",FormRequest("subject",false) %> value="articles">Question about Articles</option>
<option <%= dmxSetSelectOption("advertising",FormRequest("subject",false) %> value="advertising">Advertising with Us</option>
<option <%= dmxSetSelectOption("general",FormRequest("subject",false) %> value="general">General Inquiry</option>
</select>
</label>
<%= dmxval1.GenerateError("form1","subject","allformats",",," %>
<label> </label>
<br /></td>
</tr>
<tr>
<td colspan="2"><label>
<textarea name="comments" id="comments" cols="45" rows="5"><%= dmxSetValue("", FormRequest("comments") %></textarea>
</label>
<%= dmxval1.GenerateError("form1","comments","disallowedcond","://,," %></td>
</tr>
<tr>
<td> </td>
<td>[img]HDWASPFormCaptcha/ASPFormCaptcha.asp?width=180&height=60&letter_count=5&min_size=14&distort=1&rcolor=0&noise=2&ncolor=CC6666&bcolor=ffffff&tcolor=000000" width="180" height="60" id="captchaimg" alt="security code" border="0" /><br />
Enter Security Code:<br />
<input type="text" size="20" name="hdcaptcha" id="hdcaptcha" value="<%= dmxSetValue("", FormRequest("hdcaptcha") %>" />
<br />
<script language=vbscript runat=server>
Sub HDWCaptchaInvalidMessage
If (Request.QueryString("hdwmsg" = "invalid" Then Response.Write chr(60) & "font color=red" & chr(62) & "Please, enter the correct security code." & chr(60) & "/font" & chr(62)
End Sub
</script>
<% HDWCaptchaInvalidMessage %>
<script type="text/javascript">function HDW_getCookie(name){ var cname = "; " + name + "=";var dc = ";"+document.cookie; dc = dc.replace(/%5F/g,"_" if(dc.length > 0) {begin = dc.indexOf(cname); if (begin != -1) {begin += cname.length; end = dc.indexOf(";", begin); if(end == -1) end = dc.length; var rt = dc.substring(begin, end); rt = rt.replace(/\+/g," " return unescape(rt); } } return null;}try {var items = document.getElementsByTagName("input"for(i=0;i < items.length;i++)if (items[i].name != "hdcaptcha" && items[i].name != "hdwfail" )try{var ck = HDW_getCookie("hdw"+items[i].name);if (ck != "" && ck != null){if (items[i].type == "checkbox"items[i].checked = true;else if (items[i].type == "radio" && items[i].value == ck)items[i].checked = true; else items[i].value = ck;}} catch (e) {}var items = document.getElementsByTagName("select"for(i=0;i < items.length;i++)try{var ck = HDW_getCookie("hdw"+items[i].name);if (ck != "" && ck != null){for (j=0;j < items[i].length;j++)if (items[i].options[j].value == ck)items[i].selectedIndex = j; }} catch (e) {}var items = document.getElementsByTagName("textarea"for(i=0;i < items.length;i++)try{var ck = HDW_getCookie("hdw"+items[i].name);if (ck != "" && ck != null)items[i].value = ck;} catch (e) {}} catch (e) {}</script>
<br />
<label>
<input type="submit" name="button" id="button" value="Submit" />
</label></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<input type="hidden" name="hdwfail" id="hdwfail" value="oops.asp" />
<% dmxval1.ShowBotCheckError() %>
</form>
[/html]
[html]
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="ScriptLibrary/dmxValidator.asp" -->
<%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")
If (Request.QueryString <> "" Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%>
<%
' Universal Form Validator ASP 1.5.6
dim dmxval1, DMX_validateAction
set dmxval1 = new dmxValidator
dmxval1.ScriptFolder = "ScriptLibrary"
dmxval1.CSValidateOnChange = true
dmxval1.CSValidateOnSubmit = true
dmxval1.ReenableJavascript = true
dmxval1.UseBotCheck = true
dmxval1.ReportType = 4
dmxval1.ErrorFont = "Arial"
dmxval1.ErrorFontSize = 12
dmxval1.ErrorColor = "#ffffff"
dmxval1.ErrorBgColor = "#ff0000"
dmxval1.ErrorBold = true
dmxval1.ErrorItalic = false
dmxval1.ErrorImage = ""
dmxval1.ErrorFixed = "Custom"
dmxval1.ErrorPadding = 4
dmxval1.BorderColor = "#FF0000"
dmxval1.CssErrorFile = "validatorError7"
dmxval1.ErrorPreset = "error_five.txt"
dmxval1.TooltipPosition = "top"
dmxval1.CssHintFile = "validatorHint7"
dmxval1.HintPreset = "blue.txt"
dmxval1.HintTooltipPosition = "top"
dmxval1.HintBorderColor = "#0099ff"
dmxval1.HintBorderStyle = "solid"
dmxval1.HintBgColor = "#003399"
dmxval1.HintTextColor = "#ffffff"
dmxval1.HintTextFont = "Arial"
dmxval1.HintTextSize = 12
dmxval1.HintTextBold = false
dmxval1.HintTextItalic = false
dmxval1.HintBoxWidth = 200
dmxval1.HintImage = ""
dmxval1.HintFixed = "Custom"
dmxval1.HintPadding = 4
dmxval1.UseCustomFocusClass = "fixed"
dmxval1.FocusBorderStyle = "groove"
dmxval1.FocusBorderSize = 2
dmxval1.FocusBorderColor = "#C3D9FF"
dmxval1.FocusBgColor = "#FFFFFF"
dmxval1.FocusTextColor = "#000000"
dmxval1.UseCustomValidClass = "fixed"
dmxval1.ValidBorderStyle = "groove"
dmxval1.ValidBorderSize = 2
dmxval1.ValidBorderColor = "#00FF00"
dmxval1.ValidBgColor = "#FFFFFF"
dmxval1.ValidTextColor = "#000000"
dmxval1.UseCustomInvalidClass = "fixed"
dmxval1.InvalidBorderStyle = "groove"
dmxval1.InvalidBorderSize = 2
dmxval1.InvalidBorderColor = "#FF0000"
dmxval1.InvalidBgColor = "#FFFFFF"
dmxval1.InvalidTextColor = "#000000"
dmxval1.AddRule "form1", "agree", "allformats", ",,", "true", "", "", "", ""
dmxval1.AddRule "form1", "name", "disallowedcond", "://,,", "true", "Mandatory Field. No links allowed.", "", "", ""
dmxval1.AddRule "form1", "phone", "allformats", ",,", "true", "", "", "", ""
dmxval1.AddRule "form1", "email", "emailcond", ",,", "true", "", "", "", ""
dmxval1.AddRule "form1", "comments", "disallowedcond", "://,,", "false", "Sorry, no links allowed.", "", "", ""
dmxval1.AddRule "form1", "subject", "allformats", ",,", "true", "", "", "", ""
dmxval1.AddMask "form1", "phone", "phone", "North America"
dmxval1.Validate
%>
[/html]
[html]
<form action="<%=DMX_validateAction%>" method="post" name="form1" id="form1">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><h2 class="employmentheader">NOTE: Content REmoved. [/h2]
<p><strong>Please acknowledge your understanding of this policy by clicking the box below.</strong></p>
<p>
<label>
<input type="checkbox" name="agree" id="agree" />
</label>
<%= dmxval1.GenerateError("form1","agree","allformats",",," %> Content removed </p></td>
</tr>
<tr>
<td width="30%">Name</td>
<td width="70%"><label>
<input name="name" type="text" id="name" value="<%= dmxSetValue("", FormRequest("name") %>" />
</label>
<%= dmxval1.GenerateError("form1","name","disallowedcond","://,," %> * Mandatory </td>
</tr>
<tr>
<td>Phone</td>
<td><label>
<input name="phone" type="text" id="phone" value="<%= dmxSetValue("", FormRequest("phone") %>" />
</label>
<%= dmxval1.GenerateError("form1","phone","allformats",",," %></td>
</tr>
<tr>
<td>Email</td>
<td><input name="email" type="text" id="email" value="<%= dmxSetValue("", FormRequest("email") %>" />
<%= dmxval1.GenerateError("form1","email","emailcond",",," %>
<label> </label>
* Mandatory </td>
</tr>
<tr>
<td>Job Hunting?</td>
<td><p>
<label>
<input name="jobhunting" type="radio" id="jobhunting_2" value="no" checked="checked" <%= dmxSetRadio("no",FormRequest("jobhunting") %> />
No</label>
- If yes <a href="job-search.asp">Go HERE</a><br />
</p></td>
</tr>
<tr>
<td>Subject</td>
<td><label>
<select name="subject" id="subject">
<option value="" selected="selected">Must Choose One</option>
<option <%= dmxSetSelectOption("website",FormRequest("subject",false) %> value="website">Question about Website</option>
<option <%= dmxSetSelectOption("retirement homes",FormRequest("subject",false) %> value="retirement homes">Question about Retirement Living</option>
<option <%= dmxSetSelectOption("resources",FormRequest("subject",false) %> value="resources">Question about Resources</option>
<option <%= dmxSetSelectOption("articles",FormRequest("subject",false) %> value="articles">Question about Articles</option>
<option <%= dmxSetSelectOption("advertising",FormRequest("subject",false) %> value="advertising">Advertising with Us</option>
<option <%= dmxSetSelectOption("general",FormRequest("subject",false) %> value="general">General Inquiry</option>
</select>
</label>
<%= dmxval1.GenerateError("form1","subject","allformats",",," %>
<label> </label>
<br /></td>
</tr>
<tr>
<td colspan="2"><label>
<textarea name="comments" id="comments" cols="45" rows="5"><%= dmxSetValue("", FormRequest("comments") %></textarea>
</label>
<%= dmxval1.GenerateError("form1","comments","disallowedcond","://,," %></td>
</tr>
<tr>
<td> </td>
<td>[img]HDWASPFormCaptcha/ASPFormCaptcha.asp?width=180&height=60&letter_count=5&min_size=14&distort=1&rcolor=0&noise=2&ncolor=CC6666&bcolor=ffffff&tcolor=000000" width="180" height="60" id="captchaimg" alt="security code" border="0" /><br />
Enter Security Code:<br />
<input type="text" size="20" name="hdcaptcha" id="hdcaptcha" value="<%= dmxSetValue("", FormRequest("hdcaptcha") %>" />
<br />
<script language=vbscript runat=server>
Sub HDWCaptchaInvalidMessage
If (Request.QueryString("hdwmsg" = "invalid" Then Response.Write chr(60) & "font color=red" & chr(62) & "Please, enter the correct security code." & chr(60) & "/font" & chr(62)
End Sub
</script>
<% HDWCaptchaInvalidMessage %>
<script type="text/javascript">function HDW_getCookie(name){ var cname = "; " + name + "=";var dc = ";"+document.cookie; dc = dc.replace(/%5F/g,"_" if(dc.length > 0) {begin = dc.indexOf(cname); if (begin != -1) {begin += cname.length; end = dc.indexOf(";", begin); if(end == -1) end = dc.length; var rt = dc.substring(begin, end); rt = rt.replace(/\+/g," " return unescape(rt); } } return null;}try {var items = document.getElementsByTagName("input"for(i=0;i < items.length;i++)if (items[i].name != "hdcaptcha" && items[i].name != "hdwfail" )try{var ck = HDW_getCookie("hdw"+items[i].name);if (ck != "" && ck != null){if (items[i].type == "checkbox"items[i].checked = true;else if (items[i].type == "radio" && items[i].value == ck)items[i].checked = true; else items[i].value = ck;}} catch (e) {}var items = document.getElementsByTagName("select"for(i=0;i < items.length;i++)try{var ck = HDW_getCookie("hdw"+items[i].name);if (ck != "" && ck != null){for (j=0;j < items[i].length;j++)if (items[i].options[j].value == ck)items[i].selectedIndex = j; }} catch (e) {}var items = document.getElementsByTagName("textarea"for(i=0;i < items.length;i++)try{var ck = HDW_getCookie("hdw"+items[i].name);if (ck != "" && ck != null)items[i].value = ck;} catch (e) {}} catch (e) {}</script>
<br />
<label>
<input type="submit" name="button" id="button" value="Submit" />
</label></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<input type="hidden" name="hdwfail" id="hdwfail" value="oops.asp" />
<% dmxval1.ShowBotCheckError() %>
</form>
[/html]