Leif
01-20-2006, 04:23 PM
Hi,
I'm trying to edit a project data form in which the submit button is associated with the function below (through onclick). As far as I can tell, this function saves to the database all the information in the form and then redirects me to the "view project" page. Is there a way to edit this function so that after clicking the submit button it will still save all the data but take me to a different page (of my choice)? Thanks.
function submitIt() {
var f = document.editFrm;
var msg = '';
if (f.project_name.value.length < 3) {
msg += "\n<?php echo $AppUI->_('projectsValidName', UI_OUTPUT_JS);?>";
f.project_name.focus();
}
if (f.project_color_identifier.value.length < 3) {
msg += "\n<?php echo $AppUI->_('projectsColor', UI_OUTPUT_JS);?>";
f.project_color_identifier.focus();
}
if (f.project_company.options[f.project_company.selectedIndex].value < 1) {
msg += "\n<?php echo $AppUI->_('projectsBadCompany', UI_OUTPUT_JS);?>";
f.project_name.focus();
}
/*
if (f.project_end_date.value > 0 && f.project_end_date.value < f.project_start_date.value) {
msg += "\n<?php echo $AppUI->_('projectsBadEndDate1');?>";
}
if (f.project_actual_end_date.value > 0 && f.project_actual_end_date.value < f.project_start_date.value) {
msg += "\n<?php echo $AppUI->_('projectsBadEndDate2');?>";
}
*/
if (msg.length < 1) {
f.submit();
} else {
alert(msg);
}
}
I'm trying to edit a project data form in which the submit button is associated with the function below (through onclick). As far as I can tell, this function saves to the database all the information in the form and then redirects me to the "view project" page. Is there a way to edit this function so that after clicking the submit button it will still save all the data but take me to a different page (of my choice)? Thanks.
function submitIt() {
var f = document.editFrm;
var msg = '';
if (f.project_name.value.length < 3) {
msg += "\n<?php echo $AppUI->_('projectsValidName', UI_OUTPUT_JS);?>";
f.project_name.focus();
}
if (f.project_color_identifier.value.length < 3) {
msg += "\n<?php echo $AppUI->_('projectsColor', UI_OUTPUT_JS);?>";
f.project_color_identifier.focus();
}
if (f.project_company.options[f.project_company.selectedIndex].value < 1) {
msg += "\n<?php echo $AppUI->_('projectsBadCompany', UI_OUTPUT_JS);?>";
f.project_name.focus();
}
/*
if (f.project_end_date.value > 0 && f.project_end_date.value < f.project_start_date.value) {
msg += "\n<?php echo $AppUI->_('projectsBadEndDate1');?>";
}
if (f.project_actual_end_date.value > 0 && f.project_actual_end_date.value < f.project_start_date.value) {
msg += "\n<?php echo $AppUI->_('projectsBadEndDate2');?>";
}
*/
if (msg.length < 1) {
f.submit();
} else {
alert(msg);
}
}