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:
james
2005-02-21 23:07:10 +00:00
parent d6d1e3eca9
commit a2b274f4b9
4 changed files with 58 additions and 36 deletions

View File

@@ -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))
{