473,326 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 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 1536

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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.