forked from science-ation/science-ation
add two new js functions:
- fieldChanged - confirmChanges call fieldChanged when any field in any of the registraiton forms are chagned call confirmChanges when the "back to summary" link is changed, to warn them if they have any unsaved changes remove "(discard changes") from the "back to summary" links.
This commit is contained in:
parent
d6d1e3eca9
commit
a2b274f4b9
@ -206,6 +206,28 @@ function em(str,domain)
|
||||
{
|
||||
document.write('<a href="ma'+'il'+'to:' + str + '@' + domain + '">' + str + '@' + domain + '</a>');
|
||||
}
|
||||
|
||||
var anyFieldHasBeenChanged=false;
|
||||
|
||||
function fieldChanged()
|
||||
{
|
||||
anyFieldHasBeenChanged=true;
|
||||
}
|
||||
|
||||
function confirmChanges()
|
||||
{
|
||||
if(anyFieldHasBeenChanged)
|
||||
{
|
||||
var okay=confirm('<?=i18n("You have unsaved changes. Click \"Cancel\" to return so you can save your changes, or press \"OK\" to discard your changes and continue")?>');
|
||||
if(okay)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
-->
|
||||
</script>
|
||||
|
||||
@ -352,7 +374,7 @@ function emit_year_selector($name,$selected="",$min=0,$max=0)
|
||||
echo "</select>\n";
|
||||
}
|
||||
|
||||
function emit_province_selector($name,$selected="")
|
||||
function emit_province_selector($name,$selected="",$extra="")
|
||||
{
|
||||
$q=mysql_query("SELECT * FROM provinces ORDER BY province");
|
||||
if(mysql_num_rows($q)==1)
|
||||
@ -363,7 +385,7 @@ function emit_province_selector($name,$selected="")
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<select name=\"$name\">\n";
|
||||
echo "<select name=\"$name\" $extra>\n";
|
||||
echo "<option value=\"\">".i18n("Select a Province")."</option>\n";
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
|
@ -28,7 +28,7 @@
|
||||
//send the header
|
||||
send_header("Judges Registration - Areas of Expertise Information");
|
||||
|
||||
echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary (discard changes)")."</a><br />";
|
||||
echo "<a onclick=\"return confirmChanges();\" href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
||||
echo "<br />";
|
||||
|
||||
if($_POST['action']=="save")
|
||||
@ -73,7 +73,7 @@ if($newstatus!="complete")
|
||||
}
|
||||
else
|
||||
{
|
||||
echo happy(i18n("Areas of Expertise Inf(rmation Complete"));
|
||||
echo happy(i18n("Areas of Expertise Information Complete"));
|
||||
}
|
||||
|
||||
echo "<form name=\"expertiseform\" method=\"post\" action=\"register_judges_expertise.php\">\n";
|
||||
@ -113,7 +113,7 @@ else
|
||||
{
|
||||
if($expertise[$r->id]==$x) $sel="checked=\"checked\""; else $sel="";
|
||||
|
||||
echo "<td width=\"30\"><input $sel type=\"radio\" name=\"division[$r->id]\" value=\"$x\" /></td>";
|
||||
echo "<td width=\"30\"><input onclick=\"fieldChanged()\" $sel type=\"radio\" name=\"division[$r->id]\" value=\"$x\" /></td>";
|
||||
}
|
||||
echo "<td width=\"100\"></td>";
|
||||
echo "</tr>";
|
||||
@ -129,7 +129,7 @@ else
|
||||
echo "<td> </td>";
|
||||
if($subexpertise[$subr->id]) $ch="checked=\"checked\""; else $ch="";
|
||||
|
||||
echo "<td><input $ch type=\"checkbox\" name=\"subdivision[$subr->id]\" value=\"1\" /></td>";
|
||||
echo "<td><input onclick=\"fieldChanged()\" $ch type=\"checkbox\" name=\"subdivision[$subr->id]\" value=\"1\" /></td>";
|
||||
echo "<td colspan=\"5\">";
|
||||
echo "$subr->subdivision";
|
||||
echo "</td>";
|
||||
@ -152,7 +152,7 @@ else
|
||||
echo "<input type=\"submit\" value=\"".i18n("Save Areas of Expertise Information")."\" />\n";
|
||||
echo "</form>";
|
||||
echo "<br />";
|
||||
echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary (discard changes)")."</a><br />";
|
||||
echo "<a onclick=\"return confirmChanges();\" href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
||||
|
||||
|
||||
send_footer();
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
if(!$_SESSION['judges_password_expired'])
|
||||
{
|
||||
echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary (discard changes)")."</a><br />";
|
||||
echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
||||
echo "<br />";
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
if($_SESSION['judges_password_expired'])
|
||||
{
|
||||
unset($_SESSION['judges_password_expired']);
|
||||
echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary (discard changes)")."</a><br />";
|
||||
echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
||||
echo "<br />";
|
||||
}
|
||||
}
|
||||
@ -104,7 +104,7 @@ echo "</form>";
|
||||
if(!$_SESSION['judges_password_expired'])
|
||||
{
|
||||
echo "<br />";
|
||||
echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary (discard changes)")."</a><br />";
|
||||
echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
||||
}
|
||||
|
||||
send_footer();
|
||||
|
@ -28,7 +28,7 @@
|
||||
//send the header
|
||||
send_header("Judges Registration - Personal Information");
|
||||
|
||||
echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary (discard changes)")."</a><br />";
|
||||
echo "<a onclick=\"return confirmChanges();\" href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
||||
echo "<br />";
|
||||
|
||||
if($_POST['action']=="save")
|
||||
@ -96,32 +96,32 @@ else
|
||||
echo "<table>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td>".i18n("First Name")."</td><td><input type=\"text\" name=\"firstname\" value=\"$judgeinfo->firstname\" /></td>\n";
|
||||
echo " <td>".i18n("Last Name")."</td><td><input type=\"text\" name=\"lastname\" value=\"$judgeinfo->lastname\" /></td>\n";
|
||||
echo " <td>".i18n("First Name")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"firstname\" value=\"$judgeinfo->firstname\" /></td>\n";
|
||||
echo " <td>".i18n("Last Name")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"lastname\" value=\"$judgeinfo->lastname\" /></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo " <td>".i18n("Email Address")."</td><td><input type=\"text\" name=\"email\" value=\"$judgeinfo->email\" /></td>\n";
|
||||
echo " <td>".i18n("City")."</td><td><input type=\"text\" name=\"city\" value=\"$judgeinfo->city\" /></td>\n";
|
||||
echo " <td>".i18n("Email Address")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"email\" value=\"$judgeinfo->email\" /></td>\n";
|
||||
echo " <td>".i18n("City")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"city\" value=\"$judgeinfo->city\" /></td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo " <td>".i18n("Address 1")."</td><td><input type=\"text\" name=\"address\" value=\"$judgeinfo->address\" /></td>\n";
|
||||
echo " <td>".i18n("Address 1")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"address\" value=\"$judgeinfo->address\" /></td>\n";
|
||||
echo " <td>".i18n("Province")."</td><td>";
|
||||
emit_province_selector("province",$judgeinfo->province);
|
||||
emit_province_selector("province",$judgeinfo->province,"onchange=\"fieldChanged()\"");
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo " <td>".i18n("Address 2")."</td><td><input type=\"text\" name=\"address2\" value=\"$judgeinfo->address2\" /></td>\n";
|
||||
echo " <td>".i18n("Phone (Home)")."</td><td><input type=\"text\" name=\"phonehome\" value=\"$judgeinfo->phonehome\" /></td>\n";
|
||||
echo " <td>".i18n("Address 2")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"address2\" value=\"$judgeinfo->address2\" /></td>\n";
|
||||
echo " <td>".i18n("Phone (Home)")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"phonehome\" value=\"$judgeinfo->phonehome\" /></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td>".i18n("Postal Code")."</td><td><input type=\"text\" name=\"postalcode\" value=\"$judgeinfo->postalcode\" /></td>\n";
|
||||
echo " <td>".i18n("Phone (Work)")."</td><td><input type=\"text\" name=\"phonework\" value=\"$judgeinfo->phonework\" /> ext<input size=\"5\" type=\"text\" name=\"phoneworkext\" value=\"$judgeinfo->phoneworkext\" /></td>\n";
|
||||
echo " <td>".i18n("Postal Code")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"postalcode\" value=\"$judgeinfo->postalcode\" /></td>\n";
|
||||
echo " <td>".i18n("Phone (Work)")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"phonework\" value=\"$judgeinfo->phonework\" /> ext<input size=\"5\" onchange=\"fieldChanged()\" type=\"text\" name=\"phoneworkext\" value=\"$judgeinfo->phoneworkext\" /></td>\n";
|
||||
echo "</tr>";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td>".i18n("Organization")."</td><td><input type=\"text\" name=\"organization\" value=\"$judgeinfo->organization\" /></td>\n";
|
||||
echo " <td>".i18n("Phone (Cell)")."</td><td><input type=\"text\" name=\"phonecell\" value=\"$judgeinfo->phonecell\" /></td>\n";
|
||||
echo " <td>".i18n("Organization")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"organization\" value=\"$judgeinfo->organization\" /></td>\n";
|
||||
echo " <td>".i18n("Phone (Cell)")."</td><td><input onchange=\"fieldChanged()\" type=\"text\" name=\"phonecell\" value=\"$judgeinfo->phonecell\" /></td>\n";
|
||||
echo "</tr>";
|
||||
|
||||
echo "<tr><td colspan=\"4\"><hr /></td></tr>";
|
||||
@ -129,7 +129,7 @@ echo "<tr><td colspan=\"4\"><hr /></td></tr>";
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan=\"2\">".i18n("Age category preference")."</td><td colspan=\"2\">";
|
||||
$q=mysql_query("SELECT * FROM projectcategories ORDER BY mingrade");
|
||||
echo "<select name=\"catpref\">";
|
||||
echo "<select name=\"catpref\" onchange=\"fieldChanged()\" >";
|
||||
echo "<option value=\"\">".i18n("Doesn't Matter")."</option>\n";
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
@ -146,7 +146,7 @@ echo "</tr>\n";
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan=\"2\">".i18n("Division preference")."</td><td colspan=\"2\">";
|
||||
$q=mysql_query("SELECT * FROM projectdivisions ORDER BY division");
|
||||
echo "<select name=\"divpref\">";
|
||||
echo "<select name=\"divpref\" onchange=\"fieldChanged()\" >";
|
||||
echo "<option value=\"\">".i18n("Doesn't Matter")."</option>\n";
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
@ -161,12 +161,12 @@ echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan=\"2\">".i18n("Highest post-secondary degree")."</td>";
|
||||
echo " <td colspan=\"2\"><input type=\"text\" name=\"highest_psd\" size=\"35\" value=\"$judgeinfo->highest_psd\" /></td>\n";
|
||||
echo " <td colspan=\"2\"><input onchange=\"fieldChanged()\" type=\"text\" name=\"highest_psd\" size=\"35\" value=\"$judgeinfo->highest_psd\" /></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan=\"2\">".i18n("Other professional qualifications")."</td>";
|
||||
echo " <td colspan=\"2\"><input type=\"text\" name=\"professional_quals\" size=\"35\" value=\"$judgeinfo->professional_quals\" /></td>\n";
|
||||
echo " <td colspan=\"2\"><input onchange=\"fieldChanged()\" type=\"text\" name=\"professional_quals\" size=\"35\" value=\"$judgeinfo->professional_quals\" /></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
@ -186,7 +186,7 @@ while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if(in_array($r->lang,$currentlanguages)) $ch="checked=\"checked\""; else $ch="";
|
||||
|
||||
echo "<input $ch type=\"checkbox\" name=\"languages[]\" value=\"$r->lang\" /> $r->langname <br />";
|
||||
echo "<input onclick=\"fieldChanged()\" $ch type=\"checkbox\" name=\"languages[]\" value=\"$r->lang\" /> $r->langname <br />";
|
||||
}
|
||||
|
||||
echo " </td>\n";
|
||||
@ -194,27 +194,27 @@ echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan=\"2\">".i18n("Years of judging experience at school/local level")."</td>\n";
|
||||
echo " <td colspan=\"2\"><input type=\"text\" name=\"years_school\" value=\"$judgeinfo->years_school\" size=\"3\" /></td>\n";
|
||||
echo " <td colspan=\"2\"><input onchange=\"fieldChanged()\" type=\"text\" name=\"years_school\" value=\"$judgeinfo->years_school\" size=\"3\" /></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan=\"2\">".i18n("Years of judging experience at regional level")."</td>\n";
|
||||
echo " <td colspan=\"2\"><input type=\"text\" name=\"years_regional\" value=\"$judgeinfo->years_regional\" size=\"3\" /></td>\n";
|
||||
echo " <td colspan=\"2\"><input onchange=\"fieldChanged()\" type=\"text\" name=\"years_regional\" value=\"$judgeinfo->years_regional\" size=\"3\" /></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan=\"2\">".i18n("Years of judging experience at national level")."</td>\n";
|
||||
echo " <td colspan=\"2\"><input type=\"text\" name=\"years_national\" value=\"$judgeinfo->years_national\" size=\"3\" /></td>\n";
|
||||
echo " <td colspan=\"2\"><input onchange=\"fieldChanged()\" type=\"text\" name=\"years_national\" value=\"$judgeinfo->years_national\" size=\"3\" /></td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo " <td colspan=\"2\">".i18n("Willing to act as a division chair?")."</td>\n";
|
||||
echo " <td colspan=\"2\">";
|
||||
if($judgeinfo->willing_chair=="no") $ch="checked=\"checked\""; else $ch="";
|
||||
echo "<input $ch type=\"radio\" name=\"willing_chair\" value=\"no\" />No";
|
||||
echo "<input onclick=\"fieldChanged()\" $ch type=\"radio\" name=\"willing_chair\" value=\"no\" />No";
|
||||
echo " ";
|
||||
if($judgeinfo->willing_chair=="yes") $ch="checked=\"checked\""; else $ch="";
|
||||
echo "<input $ch type=\"radio\" name=\"willing_chair\" value=\"yes\" />Yes";
|
||||
echo "<input onclick=\"fieldChanged()\" $ch type=\"radio\" name=\"willing_chair\" value=\"yes\" />Yes";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
@ -222,10 +222,10 @@ echo "<tr>\n";
|
||||
echo " <td colspan=\"2\">".i18n("Attending lunch?")."</td>\n";
|
||||
echo " <td colspan=\"2\">";
|
||||
if($judgeinfo->attending_lunch=="no") $ch="checked=\"checked\""; else $ch="";
|
||||
echo "<input $ch type=\"radio\" name=\"attending_lunch\" value=\"no\" />No";
|
||||
echo "<input onclick=\"fieldChanged()\" $ch type=\"radio\" name=\"attending_lunch\" value=\"no\" />No";
|
||||
echo " ";
|
||||
if($judgeinfo->attending_lunch=="yes") $ch="checked=\"checked\""; else $ch="";
|
||||
echo "<input $ch type=\"radio\" name=\"attending_lunch\" value=\"yes\" />Yes";
|
||||
echo "<input onclick=\"fieldChanged()\" $ch type=\"radio\" name=\"attending_lunch\" value=\"yes\" />Yes";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
@ -235,7 +235,7 @@ echo "<input type=\"submit\" value=\"".i18n("Save Personal Information")."\" />\
|
||||
echo "</form>";
|
||||
|
||||
echo "<br />";
|
||||
echo "<a href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary (discard changes)")."</a><br />";
|
||||
echo "<a onclick=\"return confirmChanges();\" href=\"register_judges_main.php\"><< ".i18n("Back to Judges Registration Summary")."</a><br />";
|
||||
|
||||
send_footer();
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user