<%--
Document : AddCity
Created on : Oct 6, 2009, 9:14:52 PM
Author : Vishal
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body onload="ShowMessages();">
<html:form action="AddPage.do">
<p><a href="HomePage.do">HomePage</a></p>
Cityname:
<input type="text" name="cn" value="">
PinCode:
<input type="text" name="pc" value=""><br>
<input type="button" name="Submit" value="Submit1" onClick="checkpincode();onSubmit()">
<div id="message" style="position:relative;left:0;top:0;display:none"><html:errors/></div>
</html:form>
</body>
</html>
<script>
function onSubmit()
{
document.forms[0].action="AddPageSuccess.do";
document.forms[0].submit();
}
function ShowMessages()
{
var msg= document.getElementById("message").innerHTML;
if(msg!=null && msg.length >0)
{
msg=msg.replace(/<BR>/g,"\n ");
msg=msg.replace(/<br>/g,"\n ");
alert(msg);
document.getElementById("message").innerHTML="";
}
}
</script>
vishalanuj
0
Newbie Poster
Recommended Answers
Jump to PostonChange - the onchange event occurs when a control loses the input focus and its value has been modified since gaining focus. This attribute applies to the following elements: INPUT, SELECT, and TEXTAREA.
Jump to Post> Does [0-9] need to be in quotes?
No, it needs to be placed inside forward slashes to be considered as a regular expression. Of course, if you place them inside quotes, you need to explicitly use the RegExp() constructor.
@vishalanuj
…
That regex won't work. Try something like:
All 5 Replies
vishalanuj
0
Newbie Poster
peter_budo
2,532
Code tags enforcer
Team Colleague
Featured Poster
vishalanuj
0
Newbie Poster
ddempsey96
0
Newbie Poster
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.