Posted: Thu Mar 27, 2008 12:53 am Post subject: creating a sticky form compatible with onChange
creating a sticky form compatible with onChange
Hi
I was using PHP sessions to create a sticky form but a
button was needed to reload the page.
I am new to Java and I have decided to do away with the button.
Using onChange="javascript:OnChange(this) to cause the
page to reload once a selection is made from a dynamic dropdown works.
The problem is the input box and other dropdown on the same page lose
their information. How can I create a sticky form that is
compatible with onChange?
Thanks
Code:
<?
include("../priority_low_to_high_in.php");//proiority drop down
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Calendar</title>
<link href="../config.css" rel="stylesheet" type="text/css"/>
<script language="JavaScript" type="text/JavaScript">
<!--
function OnChange(dropdown)
{
window.location.href="http://localhost/search_form.php?pro_id=" +
dropdown.options[dropdown.selectedIndex].value;
}
function MM_reloadPage(init)
{ //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
Joined: 02 May 2004 Posts: 4958 Location: toronto, canada
Posted: Thu Mar 27, 2008 3:09 am Post subject:
The form needs to do an onsubmit, to submit the form to the processing page...in your case you may want to use some AJAX to handle the select boxes, assuming from your description that you are dynamically changing the options based on selections from other boxes _________________ Lostboy
FYI. The first dropdown is dynamic using database listings.
The reason input box and the second dropdown are static and are
not dependant or linked to the dynamic dropdown.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum