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 4110304
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T21:55:00+00:00 2026-05-20T21:55:00+00:00

I have created a django application. Using this app users can be created or

  • 0

I have created a django application. Using this app users can be created or deleted. But while creating a user, when we leave 1 of the field (Employee ID Field) null its not getting submitted and its throwing this error – invalid literal for int() with base 10: ” . So i guess validating that field alone and submitting that form, only if employee ID Field is non null can solve my problem. So for doing that i created a javascript and wants that js function to be called before submitting. Need to submit that form only if that field is non-empty. The alert box is coming saying to Enter the employee ID, but once i click ok to alert box, the same error comes again.Can somebody help me to solve this. I am quite new to Django and programming. I will paste my code here.

Add New User to Employee List
</h4><br><br><br>
<form name="myForm" action="http://10.1.0.90:8080/createEmployee/" method="POST">
<br>Name: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="userName"  style="color: black; background-color: #BDBDBD" /><br /><br>
Designation:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<select name="designation"  style="color: black; background-color: #BDBDBD" >
 <option value="Trainee" >Trainee</option>
 <option value="Software Engineer Trainee">Software Engineer Trainee</option>
 <option value="Software Engineer">Software Engineer</option>
 <option value="Senior Software Engineer">Senior Software Engineer</option>
 <option value="Project Manager">Project Manager</option>
 <option value="System Administrator">System Administrator</option> 
 <option value="Tester">Tester</option>
</select><br>
<br>
EmployeeID:<input id ="empid" type="text" name="employeeID"  style="color: black; background-color: #BDBDBD" /><br><br>
Contact Number: <input type="text" name="contactNumber"  style="color: black; background-color: #BDBDBD" /><br><br>
Project:&nbsp;&nbsp;&nbsp;<input type="text" name="project"  style="color: black; background-color: #BDBDBD" /><br><br>
Location:&nbsp;<input type="text" name="location"  style="color: black; background-color: #BDBDBD" /><br><br>
E-mail:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="email"  style="color: black; background-color: #BDBDBD" /><br><br>
Skills:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="skills"  style="color: black; background-color: #BDBDBD" /><br><br>
Date Of Join:&nbsp;<input type="text" id="datepicker" name="dateOfJoin"  style="color: black; background-color: #BDBDBD"  /><br><br>
<br><br>
<input type="submit" value="   Submit  " onclick="isEmpty()" /><br />
</form> 
<script type="text/javascript">
function isEmpty(){
    if ((document.myForm.EmployeeID.value.length==0)) 
        {
            alert("Please Enter Employee ID");
                    return true;
        }
    else 
        { 
        return false; 
        }

}

  • 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-05-20T21:55:01+00:00Added an answer on May 20, 2026 at 9:55 pm

    mistake: “if ((” two brackets opened

    — UPDATE —

    First of all, if you get an error about converting empty or null to a number, that means you have your code wrong. Fixing it by having additional verification at the javascript means you’re making very nasty workaround without fixing error itself – if javascript fails (e.g. no javascript enabled in the browser) user still gets 50x error.

    So, fix your form to have this field required. IMO you have EmployeeID defined as non-required field in the form and then you assume, that this field is required and tries to use it.

    If you will fix your application (backend) code, then you can add verification at the frontend (javascript).

    Proper way of attaching a form verification is to attach it to the “on-submit” form handler.
    If this handler will return “false” form will not be submitted.

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

Sidebar

Related Questions

I have created a Django app and tested the application's performance by populating some
I have created a django app. Now i want to test the application's performance
I have a view in my Django application that automatically creates an image using
I have a Django app we're attempting to deploy to a Tomcat server, using
I have created a Django application. There is a filtering functionality in my application.
I have written a Django app that makes use of Python threading to create
I have created a custom dialog for Visual Studio Setup Project using the steps
I have created a C# class file by using a XSD-file as an input.
I'm going to be honest: this is a question I asked on the Django-Users
I had the following idea: Say we have a webapp written using django which

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.