Click here to Skip to main content
15,888,816 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi Friends,
I have one aspx page and html page..Here I am copying one form from my html page as below...Since this form is calling php...The validations are not getting applied in my aspx page While the validation on submit is wrkng fine in html..Dont know how to proceed please help..
PHP
<form action="LegalBay.php" method="post" name="LegalBayform" onSubmit="return LegalBay();">
Posted
Updated 2-Oct-12 22:54pm
v2
Comments
Achha Insan 3-Oct-12 5:32am    
nothing is impossible. you can do it.

Are you using client validation or server validation?

With server validation, the content is checked when the page is posted back. Where your action is to a different page, there's no opportunity to execute the server side validation.

ASP.Net 3 onwards supports "Client-Side Validation". This loads validation scripts into the web page which are executed in the client without posting back. The following is the MSDN article on client validation.

http://msdn.microsoft.com/en-us/library/yb52a4x0(v=vs.85).aspx[^]

A work around would be to post back to your asp.net page so you can validate the form. Then render a redirect page such as this:

HTML
<html>
  <head><title>Redirecting</title></head>
  <body onload="document.forms[0].submit();">
    <form action="LegayBay.php" method="post">
      <input type="hidden" name="field1" value="value1" />
      <input type="hidden" name="field2" value="value2" />
    </form>
  </body>
</html>
 
Share this answer
 
Comments
Radhika Vyas 4-Oct-12 2:56am    
Hi..My validation function is in one of my js files.. I included it in my aspx page..
<script type='text/javascript' src='jsfiles/functions.js'></script>
My form is working fine in another aspx page index.aspx...Dnt know for this aspx its not working...
Stephen Hewison 4-Oct-12 3:48am    
In most browsers pressing F12 will launch the developer tools. You can then use the script section to set a break point in your JS code. You can then step through your JS code to see where it's failing.
Hey I got solution....Actually the problem is I have pasted that form inside another form so only it doesn't work...Now working fine...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900