Solved

How to auto-populate a list menu or textfield from a text file

Posted on 2012-03-19
6
221 Views
Last Modified: 2012-05-23
I have a submission page where a user enters their contact information. They also have to enter a specific case number for their submission. Issue is that some users enter case numbers that are not in the system.

I have created a way for real case numbers to automatically populate a text file (*.txt) on a daily basis. The main issue I have is how to force users to either enter or select the correct case number. There are roughly 250 case numbers and the format is the same for the case numbers.

Any suggestions along with direction (web pages/sites) are greatly appreciated. Can I use JavaScript? What about AJAX? The page is written in classic ASP but I'm willing to modify to accomplish my needs.

Thank you for your suggestions and direction.
0
Comment
Question by:arendt73
  • 3
  • 2
6 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 37738463
rather than asking user input in a text box, show the user a drop down below the text box (like auto-suggest) and force him to select from that drop down rather than accepting from textbox.

something like this
http://www.pengoworks.com/workshop/jquery/autocomplete.htm
0
 
LVL 20

Expert Comment

by:Proculopsis
ID: 37738684
<!--

Try jQuery AutoComplete

-->

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title> - jsFiddle demo</title>
 
  <script type='text/javascript' src='http://code.jquery.com/jquery-1.7.1.js'></script>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"></script>
 
<script type='text/javascript'>//<![CDATA[

jQuery(document).ready(function() {

    $("input#autocomplete").autocomplete({
        source: ["1000", "1001", "1002", "1003", "1004", "1005", "1006", "1007", "1008", "1009"]
    });


});
//]]>  

</script>

</head>
<body>

  <input id="autocomplete" />

 </body>
</html>
0
 

Author Comment

by:arendt73
ID: 37738708
Proculopsis, thank you. I'll give this is shot.  In the meantime, the autocomplete source will be a text file (info.txt). What would the code look like pointing to the text file?
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 20

Expert Comment

by:Proculopsis
ID: 37740872
For the source option you can use a url pointing to the data, you just need to make the file available on your server, at that location.
0
 

Accepted Solution

by:
arendt73 earned 0 total points
ID: 37745141
So instead of what you have currently now,

source: ["1000", "1001", "1002", "1003", "1004", "1005", "1006", "1007", "1008", "1009"]

It would look like this?

source: www.myserver.net/test/test.txt
0
 

Author Closing Comment

by:arendt73
ID: 38001430
Solution given acceptable.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
html Uncheck Checkbox 2 25
Javascript the "if condition with Or" 8 29
Insert Button on a table 16 38
Local HTML file to display local Access MDB data in browser 4 27
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

827 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question