• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

javascript function

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
--------------------------------------------------------------------------------

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>
 
No. No. No. No. Changed my mind. Wanna come down. To see this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic