I have a comment form, on a news website, ASP page, which users fill in and it adds comments to a news article. The reader clicks on a headline and the comments open up in a new window. It already has server side validation in but i want to add some client side javascript validation. How can do i this when there is alreay a "returnvali date comment()" in? The only two fields i want to validate are "subject" and "comment" since the rest are drawn from the database. Any help would be appreciated, i'm not html or javascript or ASP literate. Thanks in advance.
This is what i want in the javascript client side validation: A pop up message should alert if the following is not the case, Subject should be minimum 1 character and maximum 50 characters. Not left empty Comment should be minimum 1 character and maximum 4000 characters. Not left empty. -
<table align="center" width="400" cellpadding="2" cellspacing="0" border="0">
-
<form action="_comments.asp?ID=<%=NID%>" method="post" name="frm3" id="frm3" onSubmit="return ValidateComment()">
-
<tr>
-
<td width="100">Name</td>
-
<td width="300"><%=Session("PMMS_USERNAME")%></td>
-
</tr><tr>
-
<td>Country</td>
-
<td width="300"><%=Session("PMMS_COUNTRY")%></td>
-
</tr><tr>
-
<td>Subject*</td>
-
<td width="300"><input type="Text" name="subject" value="" maxlength="50" class="textbox" style="width: 100%"></td>
-
</tr><tr>
-
-
-
-
-
<%
-
-
'Declare the ASP variables used
-
Dim strFormName
-
Dim strTextAreaName
-
-
'ID tag name of the HTML form the textarea is within
-
strFormName = "frm3"
-
-
'ID tag name of HTML textarea being replaced
-
strTextAreaName = "comment"
-
-
%>
-
-
-
-
-
<td valign="top">Comment*</td>
-
<td width="300"> <!-- include the Rich Text Editor -->
-
<!--#include file="richtext_editor_inc.asp" --> <textarea name="comment" id="comment" rows="6" cols="50" style="width: 100%;" class="textbox"></textarea>
-
-
-
-
-
<input type="Checkbox" name="allowE" value="1" />Allow readers to email me.
-
</td>
-
</tr><tr>
-
<td></td>
-
<td><input type="Submit" value="Leave Comment" /></td>
-
</tr>
-
<input type="Hidden" name="mode" value="set" /></form>
-
</table>
-
<br /><br />
and i think this is the server side validation. -
IF SUBJECT = "" Or IsNUll(SUBJECT) THEN MESSAGE = MESSAGE & "<li />Please enter a subject."
-
IF COMMENT = "" Or IsNUll(COMMENT) THEN MESSAGE = MESSAGE & "<li />Please enter your comments."
-
IF IsEmailValid(EMAIL) = False THEN MESSAGE = MESSAGE & "<li />Please enter a valid email address."
1 1933 Sorry i forgot to add that in addition to the above, the validation for the "subject" and "comment" should not allow "http://" in the body, a message should pop up telling them to remove "http://"
thanks in advance Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Dnna |
last post by:
I have a table which is bound to an Internet Explorer XML
data island. I'm using ASP.NET's client-side validators
for an input field in the table. The problem is that if
the input fields are in a table that is bound to the
island (such that the rows are dynamically generated by IE
from the XML data island), the validators do not work. If
the table is not bound, the validators do work, but then I
don't have the table iterating through...
|
by: Matt |
last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or
Client-Side form validation? Since I think each validator control can select
either 1) JavaScript based error dialog or 2) show the error message next to
the control. For example, if the text field is empty with RequiredField
Validator control, it can show the value in ControlToValidate property in
two ways as I mentioned.
Please advise. Thanks!
|
by: Mong |
last post by:
Hi,
I have a webform with various asp controls on it such as textboxes and
dropdownlists. I'm fairly new to asp.net coming from VB6 and am
wondering when it's best to use client side events and when it's best
to use server side events.
For example, if a textbox is to contain a date I want to validate the
date when that textbox loses the focus. If the date is not valid I
make visible a label next to the textbox telling the user it's
|
by: rmgalante |
last post by:
I have written an ASP.Net application that uses the standard
client-side and server-side validation for various fields on the form.
Some of the customers that use the form report symptoms that appear to
be the result of double-clicking the submit button on the form.
The form has three ASP:Button tags, each of which gets translated into
INPUT TYPE="SUBMIT" HTML elements. One submits the form's data. One
logs the user out. And the other...
|
by: Wysiwyg |
last post by:
I'm going back to a previous asp.net (C#) web project after a few months of
inactivity and my first form, the login, won't submit. I ran with the
debugger and still can't see how to resolve this. I am developing with
VS2003 and on Windows 2000 Server and have all of the service packs for .NET
and Windows. The application is running on an intranet and I'm running this
test with IE6. Javascript is functional.
The logon form has text fields...
| |
by: Sun Jian |
last post by:
Hi,
I am trying to customize the asp.net validation to achieve the following:
Upon submitting the form, client side validation will run, and it will stop
at the first error detected. For example if both UserID and Password text
fields are required but neither is filled in, I'd like to display the error
message (a dialogbox) "Please enter the User ID". And only after the user
has filled in UserID, it will display "Please enter the...
|
by: Anthony W DiGrigoli |
last post by:
I have two ASP.NET Server Side buttons that perform action on both the Server
and Client side. Here is the break down of code placement:
1. Server-Side Load: Contains an Add Attribute for a JavaScript event to be
fired for onClick().
2. Server-Side Click for buttons: Navigates the user to a different form
state by resetting visibility of panels on the form.
3. JavaScript to perform validation before allowing the Server-Side click to
|
by: vidya |
last post by:
Hi,
I have a button which is a web control. I have some validation in javascript
for the button in .aspx file and some in the button onclick event in code
behind(C#). I need to get through both the java script validation as well as
the click in code behind? How can this be done ? Can I call the code behind
from the javascript function?
If not can i have a separate procedure in C# file and call it from the
javascript function? If so...
|
by: Paul |
last post by:
Hi all,
I've been trying unsuccessfully to stop client side event validation.
I've created a simple page with a text box, a required field validator
and a server button with the following settings:
1. <pages enableEventValidation="false"in web.config
2. EnableClientScript="false" in the required field validator.
3. EnableEventValidation="false" in the Page directive (which, I know,
is not necessary).
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| | |