/    Sign up×
Community /Pin to ProfileBookmark

correct javascript

Hi expected functionality –
I have two drop down .when value in one drop down is chosen other should show select and when value is chosen in second first one should automatically switch to select.
so to get this i have used following javascript.

present functionality-as soon as value from one dropdown the other swtiches to select just for moment then it takes previous value.the select should be stable not for seconds

[b]<script language=”javascript”>
function submitRegion()
{

document.facilityForm.facility.selectedIndex = “0”;
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()
{document.regionForm.region.selectedIndex = “0”;

var ind = document.facilityForm.facility.selectedIndex;

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

</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:option value=”0″>SELECT</html:option>
<html:options 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:option value=”0″>SELECT</html:option>
<html:options property=”facilityList” name=”facilityForm” />
</html:select>
<br></br>
</html:form>

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

</div>

</BODY>
</html:html>

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @somsahi spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...