473,748 Members | 9,913 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem Moving to Top of Page When Submit Fails Due to Validation

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.

The form has a Submit button (asp:button) at the bottom and if the
validation has failed I want the form to return to the top, so that the
validation messages can be seen.

Could anyone please give me a code example of how to handle this?

I have tried using the click event in the code-behind page, but it
doesn't fire and I have tried putting an onclick event in the html code
e.g. <asp:button onclick="cmdSub mit_click"...> with the cmdSubmit_click
script setting focus to the first textbox, bt this gives me an error
when I try to run it:
BC30390: 'OfficeUsageSur vey._Default.Pr ivate Sub cmdSubmit_Click (sender
As Object, e As System.EventArg s)' is not accessible in this context
because it is 'Private'.

TIA for any help/advice.

Alan.

Nov 19 '05 #1
3 1443
try using button.Attribut es.Add("onclick ", "javascript : callFunction();
return false;");
"aljodo" <al************ @armstrongwatso n.co.uk> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
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.

The form has a Submit button (asp:button) at the bottom and if the
validation has failed I want the form to return to the top, so that the
validation messages can be seen.

Could anyone please give me a code example of how to handle this?

I have tried using the click event in the code-behind page, but it
doesn't fire and I have tried putting an onclick event in the html code
e.g. <asp:button onclick="cmdSub mit_click"...> with the cmdSubmit_click
script setting focus to the first textbox, bt this gives me an error
when I try to run it:
BC30390: 'OfficeUsageSur vey._Default.Pr ivate Sub cmdSubmit_Click (sender
As Object, e As System.EventArg s)' is not accessible in this context
because it is 'Private'.

TIA for any help/advice.

Alan.

Nov 19 '05 #2
Thanks for that John.
I'm a bit of a newbie to this, does it just go in the page_load event
and what does it then allow me to do?

Thanks again.

Nov 19 '05 #3
Hi Alan,

The Microsoft validator controls cannot do this. I rewrote ASP.NET
validation to give it the features everyone has requested, including
solutions for this. My solution is called Professional Validation And More:
http://www.peterblum.com/vam/home.aspx.

You can set a property to have it set focus back to the first field with an
error when the submit button is clicked.
You can set a property to do the same when the user edits a field and its
incorrect.
My enhanced ValidationSumma ry control can offer hyperlinks on each error
message that when clicked, puts focus on the field associated with the
error.
My ValidationSumma ry has an option to scroll itself into view when you click
Submit.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlu m.com
Creator of "Profession al Validation And More" at
http://www.peterblum.com/vam/home.aspx

"aljodo" <al************ @armstrongwatso n.co.uk> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
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.

The form has a Submit button (asp:button) at the bottom and if the
validation has failed I want the form to return to the top, so that the
validation messages can be seen.

Could anyone please give me a code example of how to handle this?

I have tried using the click event in the code-behind page, but it
doesn't fire and I have tried putting an onclick event in the html code
e.g. <asp:button onclick="cmdSub mit_click"...> with the cmdSubmit_click
script setting focus to the first textbox, bt this gives me an error
when I try to run it:
BC30390: 'OfficeUsageSur vey._Default.Pr ivate Sub cmdSubmit_Click (sender
As Object, e As System.EventArg s)' is not accessible in this context
because it is 'Private'.

TIA for any help/advice.

Alan.

Nov 19 '05 #4

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

Similar topics

9
2706
by: william c | last post by:
I don't really know PHP that well. I'm fixing a Perl program that accesses a db after getting form input from a PHP page. If the server-side validation fails I'd like to reload the form with all the user's info still filled in. I could embed the entire page in the Perl program but it seems like there must be a better way to go. Is there a way to get the info into the Post environment variable and add code for the PHP page to read it...
4
2648
by: bnp | last post by:
Hi All, I am quite new the JavaScript. Basically I am a C++ programmer, but now I am working on JavaScript since last 5 days. I have a problem regarding the form validation. I have created a script that validates the form fields. the validation procedure is called ONCLICK event of the submit button. Follwowing is the structure of the validation procedure.
6
4851
by: MickG | last post by:
Hi, I am trying to validate these values, this seems to work fine for the phone number and name but I am trying to get the program to fail to submit and set the focus on the date when 2006 is selected and submitted. Thanks in advance for any help.
4
1209
by: Alan Silver | last post by:
Hello, If you add (say) two text boxes to a form, then add a validator with some simple rule for one of them, you can observer the following problem:- Type some erroneous value in the text box with the validator, then click on the other text box. This makes the validator's red error message appear. Now, change the invalid text to something valid, and without clicking anywhere else, click the submit button.
2
9066
by: Jake Barnes | last post by:
Imagine I've this block of HTML: <p>Alex Schein Mailing List <input type="checkbox" name="newslettersToUse" value="133156"> (<a href="mcControlPanel.php" onClick="hideOrShowDivById('emailList133156'); return false;">See emails?</a>)</p> <form method="post" action="mcControlPanel.php" id="emailList133156" style="display:none;"><textarea name="formInputs">nazjeehaj@son.org,
2
2368
by: Darren Carter | last post by:
Hi, I have mutliple asp:Panel controls on a single page, each with a default button defined (each default button resides within its respective asp:Panel). All validation controls and buttons within each panel also have separate ValidationGroups defined. When an asp:Textbox has focus in one of the Panels and I press the enter key, my validation works great. If I press the enter key a second time, the first button on the page's onClick...
1
1890
by: =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?= | last post by:
I'm having trouble working with a Summary Validation control. I need to click my submit button twice for the Summary to display when validation errors occur on the page. Background: My page contains a radio control which the user must answer to finish the page entry. If user hits submit button without selecting item from control, summary validation error displays. In this case one click is sufficient. Once the user selects choice on...
0
2134
by: =?Utf-8?B?QmFyYmFyYSBBbGRlcnRvbg==?= | last post by:
I'm having trouble working with a Summary Validation control. I need to click my submit button twice for the Summary to display when validation errors occur on the page. Background: My page contains a radio control which the user must answer to finish the page entry. If user hits submit button without selecting item from control, summary validation error displays. In this case one click is sufficient. Once the user selects choice on...
11
6066
by: SAL | last post by:
Hello, I have a Gridview control (.net 2.0) that I'm having trouble getting the Update button to fire any kind of event or preforming the update. The datatable is based on a join so I don't know if that's what's causing the behavior or not. It seems like the Update button should at least do something. When the Edit button is clicked, the grid goes into Edit mode and the Cancel button takes the grid out of Edit mode. So, I don't get what...
0
8984
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9530
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9238
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8237
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4593
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.