Suggested values from the database - javascript

i want to suggested text values when user can type the letter in particular text box for example i will type a in my text box it will be retrieve all a value from the database and it suggested (eg: i type "a" means Air, apple, append like that) in mvc 2

You have not posted any code that you tried but if you want from scratch then have a look at following
This Jquery plugin might help you http://jqueryui.com/autocomplete/. On clicking View Source you can get all the code.
You can also have a look at this code http://www.devbridge.com/projects/autocomplete/jquery/

i think this might help. You type in a name and it brings up suggestions from a database.
http://www.w3schools.com/ajax/ajax_aspphp.asp
hope this is what you are looking for

Related

Dynamic spell-checker for HTML text box?

I have a text box, created in HTML. The user may type input into this text box. I would like to validate their input dynamically, as they type, and search for spelling mistakes in their text. If there is a spelling mistake, underline the word.
This is a common functionality I assume, but I cannot find a plugin or API call that will accomplish this for me. Can anyone please point me in the right direction? Preferably something that will work in Spanish rather than English :).
Thanks you.
There are tree options for spellchecking :
Using a jQuery plugin
Using the build-in spell checker of your browser with the spellcheckattribute
Using a spell checker in a WYSIWYG editor

javascript - How to get "writable" HTML components?

My problem is that I want to create a Firefox AddOn, and I need to extract from the HTML document every "writable" (I mean: input, textarea or other ways to write text) to work with its value.
I know the method document.getElementByTagName(), but the case is that i don't know how many tags to input text exist (or a webpage usually have on it) to refer them this way; or even if this problem can be solved otherwise.
I really appreciate any help or idea to do this efficently, so I can go forward with this project.
You only have 2 possible tags: textarea and input. The problem is that with HTML5 the input tag has several kinds of types which you can insert text but you have also another ones that you can't (like submit or radio):
color
date
datetime
email
month
number
password
search
tel
text
time
url
You can use document.querySelectorAll function to retrieve those elements:
document.querySelectorAll("textarea input[type=text] input[type=email]");
Note that I have only include text and email in the selector but was just a sample mode. You should add all the types you think necessary retrieve.
Here you have all the possible types for input tag and the browser support of those, I recommend check out the documentation to have a better idea of what tags should be relevant for you.

HTML Forms - Prewritten text

This may not be the best area for this question and if so I am sorry for that. However, I am trying to create a dead simple form that enters pre-written data into the fields when they hit a key. So example:
User Enters: Hello world, My name is...
But the input field will instead progressively write
Form: G'day, the weather is great today.
I've seen this done a few times but for some bloody reason I can't track down the tutorial for it.
Any help would be greatly appreciated.
Edit: I would like it to basically be this youtube
Use the jQuery tickertype plugin: http://www.hungry-media.com/code/jQuery/tickerType/

numerous similar AJAX suggestion boxes without ID's

I have a search box on my site that uses autocomplete to give suggestions, and it works great. Now I want to use it on several INPUT fields on a single page. However, the script uses ID tags to access the contents of the INPUT form box.
I modified this:
$('#suggest').autocomplete(
to this:
$('.suggest').autocomplete(
How do I access the INPUT box text now that I lose the ability to use getElementsById?
So, I think I know what you're asking. You have several input elements on a page, none of which have id attributes, but do have name attributes. Each input has a separate autocomplete widget attached to it, and you want to query a URL as your data source, passing in the name if the input being interacted with.
Ok.
I set up a fiddle to do what I'm describing above, which I think is what you want. See it here: http://jsfiddle.net/4GXAm/1/
The magic is here:
$(".example").autocomplete({
source: function(request, response) {
var url = "/suggest/?" + $(this.element).serialize();
alert("perform an AJAX request with " + url);
// Respond with the ajax results
response(["a", "b", "c"]);
}
});
Using .serialize() will get you a name/value pair from the input, without needing to know its id or name attribute. You can get the element being interacted with by using $(this.element) when using a callback function as your autocomplete source.
I recommend looking at an example of the autocomplete that uses a callback function as a remote data source for more details.
The jQuery UI autocomplete plugin should do the trick for you. This seems to be a scrap of what you were trying to use before, but reading the documentation should get you through it a bit better:
http://jqueryui.com/demos/autocomplete/
Just make sure to:
include the scripts and stylesheets for jquery ui on your page
make good use of $(this) to refer to the element that is being worked with. The above example is selecting all text inputs.
If you are still confused after this, I'd be glad to give more specific guidance if you can cut most of the explanation here and provide us with the actual code that isn't working, but as long as you understand the $(this) concept, I think this should get you what you need.

Multiple image upload without flash

I want to use HTML and PHP for 9 or more images upload. The problem is that I don't want 9 upload fields because it looks bad. Does anybody have any suggestions ? Maybe examples ?
Thanks.
I've been using noSWFUpload for some time and it works pretty good. It relies on XMLHttpRequest's sendAsBinary in supporting clients and falls back to iframe-based submission.
http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/
Connect to the fileInput's onchange event, hide it, get the value and add it to a textarea, and create another. Name them all the same plus an increment: field1, field2... Loop through the field names in PHP and check for existance with isset.
Or use Dojo's FileUploader and force html:
http://docs.dojocampus.org/dojox/form/FileUploader
What I have done in the past is to give an option on doing another upload, or, when they pick the first file, display it as a label, then have another box ready for them to pick another file. Each file input is actually with a unique name, so the server just goes through until it doesn't find the next file.
But, this requires a bit of javascripting. :)

Categories

Resources