<script runat="server"> Protected Sub FeedBackButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim str_q1_filter, str_q2_filter, str_q3_filter, str_q4_filter, str_filter_action As String
If string.IsNullOrEmpty(str_q1_filter) = True Then Response.Redirect("/here.aspx?valempty=yes") end if
If string.IsNullOrEmpty(str_q2_filter) = True Then Response.Redirect("/here.aspx?valempty=yes") end if
If string.IsNullOrEmpty(str_q3_filter) = True Then Response.Redirect("/here.aspx?valempty=yes") end if
If string.IsNullOrEmpty(str_q4_filter) = True Then Response.Redirect("/here.aspx?valempty=yes") end if
if str_q1_filter = "no" OR str_q2_filter = "no" OR str_q3_filter = "no" OR str_q4_filter = "no" Then Response.Redirect("/reject.aspx") ELSE Response.Redirect("/accept.aspx") end if End Sub </script>
<script type="text/javascript">
var Qvar = Request.QueryString("valempty");
if (Qvar=="yes") { alert("Please answer all questions to proceed"); }
A question about ASCX control, that worked in Umbraco 3 but not 4.
I needed a quick control to redirect a page depending upon answers....
I make it into a maco and load it into the page.
I tried it in umbraco 4 and it does not work.
It is not code behind.
<%@ Control Language="VB" ClassName="FilterQuestions" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<script runat="server">
Protected Sub FeedBackButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim str_q1_filter, str_q2_filter, str_q3_filter, str_q4_filter, str_filter_action As String
str_q1_filter = Request.Form("q1_filter")
str_q2_filter = Request.Form("q2_filter")
str_q3_filter = Request.Form("q3_filter")
str_q4_filter = Request.Form("q4_filter")
If string.IsNullOrEmpty(str_q1_filter) = True Then
Response.Redirect("/here.aspx?valempty=yes")
end if
If string.IsNullOrEmpty(str_q2_filter) = True Then
Response.Redirect("/here.aspx?valempty=yes")
end if
If string.IsNullOrEmpty(str_q3_filter) = True Then
Response.Redirect("/here.aspx?valempty=yes")
end if
If string.IsNullOrEmpty(str_q4_filter) = True Then
Response.Redirect("/here.aspx?valempty=yes")
end if
if str_q1_filter = "no" OR str_q2_filter = "no" OR str_q3_filter = "no" OR str_q4_filter = "no" Then
Response.Redirect("/reject.aspx")
ELSE
Response.Redirect("/accept.aspx")
end if
End Sub
</script>
<script type="text/javascript">
var Qvar = Request.QueryString("valempty");
if (Qvar=="yes")
{
alert("Please answer all questions to proceed");
}
</script>
<asp:Panel runat="server" ID="EmailForm">
<fieldset style="padding:10px;" >
<form id="form1" name="form1" method="post" action="" >
<p>Can you clearly see this screen </p>
<p>
<label>
<input type="radio" name="q1_filter" value="yes" />
Yes</label>
<br />
<label>
<input type="radio" name="q1_filter" value="no" />
No</label>
</p>
<p>Do you understand the English language </p>
<p>
<label>
<input type="radio" name="q2_filter" value="yes" />
Yes</label>
<br />
<label>
<input type="radio" name="q2_filter" value="no" />
No</label>
</p>
<p>Are you able to read and write </p>
<p>
<label>
<input type="radio" name="q3_filter" value="yes" />
Yes</label>
<br />
<label>
<input type="radio" name="q3_filter" value="no" />
No</label>
</p>
<p> Are you 18 years old or over</p>
<p>
<label>
<input type="radio" name="q4_filter" value="yes" />
Yes</label>
<br />
<label>
<input type="radio" name="q4_filter" value="no" />
No</label>
</p>
<p style="clear:both; padding-top:10px;">
<asp:Button ID="FeedBackButton" runat="server" OnClick="FeedBackButton_Click" Text="Submit" />
</p></form>
</fieldset>
</asp:Panel>
Just done another test...
It only works if I embed it in a template not allow in editor
is working on a reply...