File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes javascript function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "javascript function" Watch "javascript function" New topic
Author

javascript function

arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
--------------------------------------------------------------------------------

Hi I have a jsp file containing two different forms(means two drop down) with two javascript function and default value for both drop down is
SELECT.
expected functionality-is when I select from region form ,facility form should have only "select" and as soon as select value from region, facility value should be shifted to select
present functionality-if i select value from region drop down ,facility value also changes from select.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ page errorPage="error.jsp" %>
<html:html>
<HEAD>
<%@ page
language="java"
contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="../theme/Master.css" rel="stylesheet"
type="text/css">
<TITLE></TITLE>

<script language="javascript">
function submitRegion()
{

var ind = document.regionForm.region.selectedIndex;

if ( ind == 0)
{
alert('Please select the required region ..');
return;
}
else
{
document.regionForm.submit();
}
}
</script>

<script language="javascript">
function submitFacility()
{

var ind = document.facilityForm.facility.selectedIndex;

if ( ind == 0)
{
alert('Please select the required facility ..');
return;
}
else
{
document.facilityForm.submit();
}
}
</script>



</HEAD>

<BODY >
<div class="menu" id="menubar">
<!--
<%String name = (String) request.getAttribute("name");
//out.write(name);
%>
-->

<html:link action="/nation">National Audit Report</html:link>
<br></br>

<h1 style="font-size:12px">Regional Audit Report</h1>
<!-- <html:link action="/regionalauditreports">Regional Audit Report</html:link>
<<br></br>-->
<html:form action="/regionalauditreports">
Region: <html:select style="width:95px;" property="region" name="regionForm" size="1" onchange="submitRegion()">
<html ption value="0">SELECT</html ption>
<html ptions property="regionList" name="regionForm" />
</html:select>
</html:form>
<br></br>
<h1 style="font-size:12px">IATA Audit Report</h1>
<!--<html:link action="/iata">IATA Audit Report</html:link>
<br></br>-->

<html:form action="/iata">
Facility: <html:select property="facility" name="facilityForm" size="1" onchange="submitFacility()">
<html ption value="0">SELECT</html ption>
<html ptions property="facilityList" name="facilityForm" />
</html:select>
<br></br>
</html:form>

<br></br>
<html:link page="/help.jsp">Help</html:link>



</div>

</BODY>
</html:html>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javascript function