Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8237805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:35:31+00:00 2026-06-07T19:35:31+00:00

this is what is my java script function : function issueOrReturn() { var functiontype

  • 0

this is what is my java script function :

function issueOrReturn() {
    var functiontype = document.getElementById("functiontype").value;
    alert("functiontype : "+functiontype);
    if (functiontype=="issueTempcard") {
        alert("1111111111111111111111111");
        var empid = document.getElementById("empid").value;
        var tempcardnumber = document.getElementById("tempcardnumber").value;
        var dateofissue = document.getElementById("dateofissue").value;
        if(empid.length==0) {
            alert("Please enter Employee ID ");
            return false;
        }
        if(tempcardnumber.length==0) {
            alert("Please enter Card Number ");
            return false;
        }
        if(dateofissue.length==0) {
            alert("Please enter Date of issue ");
            return false;
        }
        if(empid.length > 0 && tempcardnumber.length > 0 && dateofissue.length > 0) {
            document.forms["frmTempcard"].submit();
        } else {
            alert("Please enter Employee ID and and Card Number and Date of issue ");
            return false;
        }
    }
    if (functiontype == "returnTempCard") {
        alert("222222222222222222222222222222");
        var empid = document.getElementById("empid").value;
        var dateofreturn = document.getElementById("dateofreturn").value;

        if (empid.length == 0) {
            alert("Please enter Employee ID ");
            return false;
        }
        if (dateofreturn.length == 0) {
            alert("Please enter Date of return ");
            return false;
        }
        if (empid.length > 0 && dateofreturn.length > 0) {
            document.forms["frmTempcard"].submit(); 
        } else {
            alert("Please enter Employee ID and Date of return ");
            return false;
        }
    }
}

here the functiontype is : issueTempcard the alert is printed but it is not getting in the if loop of issueTempcard hence the form is not submitted,

also please advise me whether the following way is correct to submit the form :

if (empid.length > 0 && tempcardnumber.length > 0 && dateofissue.length > 0) {
    document.forms["frmTempcard"].submit(); 
} else {
    alert("Please enter Employee ID and and Card Number and Date of issue ");
}

kindly provide me some help so that i can do it.

Regards,

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:35:34+00:00Added an answer on June 7, 2026 at 7:35 pm

    Both your function definitions miss their closing } character.
    Because of this, they are not executed (because the javascript interpreter fails to read your entire function)

    This JsFiddle shows your code up and running without a hitch.
    All i did is add the }

    To help you debug your JS code, try using Firebug, which can show you where you went wrong 😉

    Your way of submitting forms looks fine to me, but is also missing the trailing }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made this bookmarklet: javascript:(function(){var s=document.createElement('script');s.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');document.getElementsByTagName('body')[0].appendChild(s);$('#hldIntMain').hide();$('#fadeBackground').hide();return false;})() Formatted code: // Add in jQuery var
<script type=text/javascript> $(document).ready(function() { $(#paradigm_all).click(function() { var checked_status = this.checked; $(input[@name=paradigm]).each(function() { this.checked =
This is my code and in this i wanna call a java script function
Hello i have this form filling javascript: function onLine(code,nn) { document.writeform.bericht.value+=code; document.writeform.bericht.focus(); document.writeform.nickname.value+=nn; write1();
i am using java-script function when i click a td the value is stored
Given this HTML: <form id=formx> <input type=text value= /> </form> And this JavaScript: $(function()
Script function showcontent(language){ $('#content').html('Introduction to ' + language + ' language'); } $(function(){ showcontent('java');
below is a java script function and the html for the clicked item that
I have the below java script function in which I want to redirect the
I've got a Web control called Fou.ascx and it has a java script function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.