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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:51:18+00:00 2026-06-01T23:51:18+00:00

I am Developing a web application. For inputting values i am using an auto

  • 0

I am Developing a web application. For inputting values i am using an auto complete which gets its data from the database.

$(document).ready(function hello(){
    var myVar1 = <%=request.getAttribute("variable1")%>
      $("input#assignedbyid").autocomplete({
    source: myVar1
      });
});

The above given example gives me a set of values which are picked up from a database using JDBC and json code. AT any point of time the value in myvar1 looks like this::

["Kapil","Mayur","Abhinav","Chandan"]

Which comes as a source for auto complete values.
My html code where my input tag onfocus calls up the function hello().

<div id="lets"><input dojoType="dijit.form.ValidationTextBox" id="assignedbyid" name="assignedbyname"  required="true" onfocus="hello();" onblur="hi();"></div>

Now i want to have a validation check which checks that value entered by the user comes from auto complete values only("Kapil","Mayur","Abhinav","Chandan") and not any other value. I have this Code where in if no value is entered the text box shakes up(onblur="hi();"). in else part i want to that checking to be done.

<script type="text/javascript"> 
 function periodical() {
            $('#lets').effect('shake', { times: 5 }, 200);
        };
          $(document).ready(function() {
            $('#lets').hide().css('display','').fadeIn(600);
                }); 
        function hi(){
            var dude = dojo.byId("assignedbyid").value;

            if(dude==""){
                periodical();}
            else{

            if(dude)
                myVar1

                alert("value entered");}
                };
</script>

My else part is incomplete for the time being. how can this be done ?. Thanks .

  • 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-01T23:51:20+00:00Added an answer on June 1, 2026 at 11:51 pm
    var V = $("#myInput").val();
    if (V=="Kapil"||V=="Mayur"||V=="Abhinav"||V=="Chandan") {
        //do something
    }
    

    or

    var V = $("#myInput").val();
    var myArray = ["Kapil","Mayur","Abhinav","Chandan"];
    
    if ($.inArray(V, myArray)!=-1) {
        //do something
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a web application using NetBeans and MySQL as the database. I
I am developing an web application which can upload/download a file from client to
We're developing a web application which uses EJB to connect to a database. In
I'm currently developing a web application using MYSQL database InnoDB format and need some
Im Developing a web application which is very critical. So authentication has to be
I'm developing a web application for a company which I work for. My team
I am developing an web application using php. One of the requirement is the
I'm developing a web application for a new service, starting from Firefox 3.5. The
We are developing a web application using Spring framework and Hibernate ORM. As far
I'm developing a web application using ASP .NET MVC 1.0 and jQuery (including the

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.