472,364 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,364 software developers and data experts.

Page Validation and Submit problems ??

Hi,

I am creating a simple .aspx page to add some fields with validation.

I have used different .NET validations like REquiredFieldValidator,
RegularExpressionValidator and showed the summary in the bulleted list
on top. I have 3 text boxes, and two RadioButtonList. and 3 buttons.
One for Submit, Reset and Exit.

If submit is pressed page should be validated and submit (insert into
DB) , Reset- page shoule be re-loaded, Exit - go to next page.

I have tried many options and i don't know which way is the best one.

a) when i submit the page .. all validatations are working perfect,
but how should i reset the page ? (again it is doing all the
validations ). I have used javascript too but for that i remove <%@
Page Language="vb" AutoEventWireup="false"
Codebehind="AddUsers.aspx.vb"%> then only it works. But i have to use
code behind and if remove this line for sake of JS i cannot use code
behind.

b) then i thought of using my own validations in function and for that
i believe if i use <asp:textbox and on click if of submit if i write
txtFullName.value does not work .. again i need to change every tag to
input type .. is this the only way.

Please suggest me the best way.

Code I am using is as follows :-
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="AddUsers.aspx.vb"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script language="VB" runat="server">
Sub SubmitBtn_Click(sender As Object, e As EventArgs)
Response.write ("Arun Submit")
End Sub

Sub ResetBtn_Click(sender As Object, e As EventArgs)
Response.write ("Arun Reset")

End Sub

</script>
<title>AddModSysUsers</title>
<link href="incStyles.css" rel="stylesheet">
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<table border="1" cellpadding="0" cellspacing="4" width="100%"
align="center">
<tr>
<td colspan="2" class="clsFont" align="middle">
<asp:panel runat="server" id="ValidationPanel" visible="false">
<asp:ValidationSummary ID="validSummary" runat="server"
HeaderText="Check the following fields:" DisplayMode="BulletList" />
</asp:Panel>
</td>
</tr>
<tr>
<td colspan="2" align="middle" class="clsFont" height="30">
<font color="red">*</font>&nbsp;<B>Required</B>
</td>
</tr>
<tr>
<td class="clsFont" align="right" width="50%">
<font color="red">*</font>&nbsp;<B>Full Name(last, first) :</B>
&nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtFullName" runat="server" Columns="30"
MaxLength="20"></asp:TextBox>
<asp:RequiredFieldValidator id="ValidateFullName"
ControlToValidate="txtFullName" ErrorMessage="Full Name must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right" width="50%">
<font color="red">*</font>&nbsp;<B>User Name (8-15 characters)
:</B> &nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtUserName" runat="server" Columns="30"
MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator id="validateUserName"
ControlToValidate="txtUserName" ErrorMessage="User Name must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="ValRegUserName"
ControlToValidate="txtUserName" ErrorMessage="User Name Should be in
8-15 Characters." ValidationExpression=".{8,15}" Display="None"
runat="server"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>Password (8-15 characters)
:</B> &nbsp;
</td>
<td class="clsFont" align="left">
&nbsp;<asp:TextBox id="txtPassword" runat="server" Columns="30"
MaxLength="15"></asp:TextBox>
<asp:RequiredFieldValidator id="ValidatePassword"
ControlToValidate="txtPassword" ErrorMessage="Password must be filled
in" Display="None" runat="server"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator id="ValRegPassword"
runat="server" ControlToValidate="txtPassword" ErrorMessage="Password
Should be in 8-15 Characters." ValidationExpression=".{8,15}"
Display="None"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>User Level :</B> &nbsp;
</td>
<td class="clsFont" align="left">
<ASP:RadioButtonList id="radUserLevel" RepeatLayout="Table"
runat="server" RepeatDirection="Horizontal" CssClass="clsFont">
<asp:ListItem>General</asp:ListItem>
<asp:ListItem>Omega</asp:ListItem>
<asp:ListItem>Super</asp:ListItem>
</ASP:RadioButtonList>
<asp:RequiredFieldValidator id="ValidateUserLevel"
runat="server" ControlToValidate="radUserLevel" ErrorMessage="User
Level must be selected. " Display="None"
InitialValue=""></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="clsFont" align="right">
<font color="red">*</font>&nbsp;<B>Status :</B> &nbsp;
</td>
<td class="clsFont" align="left">
<ASP:RadioButtonList id="radStatus" RepeatLayout="Table"
runat="server" RepeatDirection="Horizontal" CssClass="clsFont">
<asp:ListItem>Active&nbsp;&nbsp;</asp:ListItem>
<asp:ListItem>Inactive</asp:ListItem>
</ASP:RadioButtonList>
<asp:RequiredFieldValidator id="ValidateStatus" runat="server"
ControlToValidate="radStatus" ErrorMessage="Status must be selected. "
Display="None" InitialValue=""></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td align="middle" colspan="2">
&nbsp;&nbsp;
<asp:Button id="btnSubmit" Runat="server" text="Submit" OnClick
= "SubmitBtn_Click"></asp:Button>
&nbsp;&nbsp;
<asp:Button id="btnReset" runat="server" text="Reset" OnClick =
"ResetBtn_Click" ></asp:Button>
&nbsp;&nbsp;
<input type = "reset" id="Button1" runat="server" value="reset">
&nbsp;&nbsp;
<asp:Button id="btnExit" Runat="server" text="Exit Without
Saving"></asp:Button>
</td>
</tr>
</table>
</form>
</body>
</HTML>
Nov 18 '05 #1
0 1479

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Abby Lee | last post by:
I have a for statement in my validation process I do a for loop becasue I don't know how many rows of items there are...I need to validate each item in each row. If I remove the...
10
by: Steve Benson | last post by:
Our regular programmer moved on. I'm almost clueless in Javascript/ASP and got the job of adapting existing code. In the page below, everything works until I added the function checkIt() to...
3
by: Arun K | last post by:
Hi, I am creating a simple .aspx page to add some fields with validation. I have used different .NET validations like REquiredFieldValidator, RegularExpressionValidator and showed the summary...
7
by: ani | last post by:
I have two submit buttons in my form which need to validate two different controls on the page . How do I validate portions of the asp.net page. The two submit buttons should validate their...
1
by: Liz | last post by:
I have a page with several dropdownlists, several text boxes and several buttons which perform calculations. I need to validate one dropdownlist (not the whole page) with the click of one button. I...
4
by: David Colliver | last post by:
Hi all, I am having a slight problem that hopefully, someone can help me fix. I have a form on a page. Many items on the form have validation controls attached. Also on this form are...
3
by: aljodo | last post by:
ASP.Net v1.1 & vb.net Hi all, I have a simple survey form with first name/last name text boxes at the top. I have validators on these text boxes to ensure that something is entered in them. ...
2
by: William Buchanan | last post by:
Hi folks Why are master pages such a pain? I have put a search text box and link button on my master page because I want it on all pages on my site. After lots of juggling with the different...
3
by: Ken Shimizu | last post by:
I get an error when submitting an .ASPX page in Safari beta, MAC and PC document.getElementbyId(‘FolderBrowser’).submit(); After the server side code has executed without problems I get the...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.