---
title: "Form gets submiited twice on button click"  
description: "Form gets submiited twice on button click"  
author: "Anonymous User"  
published: 2013-05-02  
updated: 2013-05-02  
canonical: https://www.mindstick.com/forum/790/form-gets-submiited-twice-on-button-click  
category: "mssql server"  
tags: ["mssql server"]  
reading_time: 1 minute  

---

# Form gets submiited twice on button click

Hi Mindstickians!\
I have called below [javascript function](https://www.mindstick.com/forum/2090/send-data-from-asp-dot-net-code-behind-to-a-javascript-function) on\
function formOnSubmit() { if (document.forms[0].ref_no.[value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) == "") {\
if (document.forms[0].acc_code.value == "") {\
if (document.forms[0].vendor_code.value == "") {\
if (document.forms[0].acc_service_tax.value == "") {\
if (document.forms[0].acc_doc_name.value == "") { [alert](https://answers.mindstick.com/qa/30927/what-is-an-alert)('Please enter atleast one [attribute](https://www.mindstick.com/blog/221/attributes-reflection) value'); return false; } } }\
} } else { return [true](https://yourviews.mindstick.com/view/81326/boycott-chinese-products-dream-will-come-true); document.forms[0].submit();\
}}where, ref_no,acc_code,vendor_code,acc_service_tax,acc_doc_name are textboxes\
The [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) is [form](https://www.mindstick.com/forum/6/multi-form-mfc-application) gets submitted twice when I enter something in ref_no texbox and form submitss once for the rest of textboxes.\
I want to know why form gets submitted twice when I enter ref_no value.\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)! \

## Replies

### Reply by AVADHESH PATEL

Hi John!\
\
Use any one that is in else condition.\
\
Use either:\
\
document.forms[0].submit();\
else\
\
return true;


---

Original Source: https://www.mindstick.com/forum/790/form-gets-submiited-twice-on-button-click

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
