onSubmit doesnt fire

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
inosent1
Forum Commoner
Posts: 97
Joined: Wed Jan 28, 2009 12:18 pm

onSubmit doesnt fire

Post by inosent1 »

Code: Select all

<script type="text/javascript"><!--
function updatesum() {
document.smartform.sumx.value = (document.smartform.rma_wg4.value -0) + (document.smartform.rma_wg3.value -0);
document.smartform.sumz.value = (document.smartform.rma_sg4.value -0) + (document.smartform.rma_sg3.value -0);
document.smartform.disability.value = (document.smartform.b_other_income_d.value -0) + (document.smartform.b_other_income_d.value -0);
document.smartform.rental.value = (document.smartform.b_other_income.value -0) + (document.smartform.b_other_income.value -0);
document.smartform.alimony.value = (document.smartform.b_other_income_a.value -0) + (document.smartform.b_other_income_a.value -0);
document.smartform.misc_inc.value = (document.smartform.b_other_income_m.value -0) + (document.smartform.cb_other_income_m.value -0);
document.smartform.other_exp.value = (document.smartform.a_ins.value -0) + (document.smartform.a_transport.value -0) + (document.smartform.c_care.value -0) + (document.smartform.cabletv.value -0) + (document.smartform.dhl_ins.value -0) + (document.smartform.electricity.value -0) + (document.smartform.food.value -0) + (document.smartform.gas.value -0) + (document.smartform.h_ins.value -0) + (document.smartform.meds.value -0) + (document.smartform.internet.value -0) + (document.smartform.l_ins.value -0) + (document.smartform.misc_ex.value -0) + (document.smartform.misc_ex2.value -0) + (document.smartform.telephone.value -0) + (document.smartform.total_rental_exp.value -0) + (document.smartform.tuition.value -0) + (document.smartform.wsg.value -0);
}
//--></script>
then

Code: Select all

<form method="POST" autocomplete="on" NAME="smartform" target="_parent" action="edit_p.php" enctype="multipart/form-data" onSubmit="return updatesum()"><a NAME="tab1"></a>
but the function never runs. what is the way to force a 'change' to call the function upon submission?
pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

Re: onSubmit doesnt fire

Post by pbs »

try using submit button and call onclick event of button instead of onsubmit event of form, may this will help you
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: onSubmit doesnt fire

Post by social_experiment »

“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply