Jump to content

get the result of a html text box before the submit is clicked


Recommended Posts

i have a html form with an input type="text" for the username registration. when the user clicks outside of this text box, i would like it to search the mysql database for that username to see if that user exists in the database before the submit button is pressed. what would you call this feature that i am asking about?

Yes, like the posted above has told you, you need AJAX it is another scripting language more complex that HTML. It is very similar to javascript

 

This is a grate place to begin learning

 

http://www.tizag.com/ajaxTutorial/

 

Good luck.

 

And, I would suggest instead of your idea, you should make a little submit button named NOT "submit" ( <input type="submit" name="check_username" )

to search for existing usernames.

 

 

I disagree, usually username validation happens while or after you type the username, and it's easy to do it that way rather than on a button. More automatic.

I would also use jQuery over that tutorial as it is already cross browser friendly.

AJAX is not a scripting langauge, it's a technique. The J in AJAX actually stands for "JavaScript", Asynchronous JavaScript and XML is the full title behind the acronym.

Also, I'd actually recommend using jQuery instead of manually writing your AJAX handler, seeing as there are quite a few pitfalls. Plus, jQuery is a whole lot simpler to use and get working quickly.

 

Lastly, it doesn't matter what you call the submit button. If you need to check for anything, besides it being set in the first place, then checking the value is a good distinguishing value.

 

In closing: It's very nice, and appreciated, that you want to help people out. In fact, it's commendable. However, please make sure that you post valid information and not false or erroneous claims. Otherwise you're not helping, but actually just creating confusion and being a hindrance to the process.

Thank you.

Geez take it easy there, you sound like [DELETED]. I was just trying to help him better understand the differences in a simpler manner. You on the other hard, are confusing the asker. Plus, it is much more convenient to get the user name match from database, with separate submit button if the user is only using PHP and not Ajax.

Ignoring the ad-hominem, you're still incorrect: It is not simpler for the user to have to click on a button, compared to it happening automatically. Neither is it that much more difficult for the developer either, if using a framework like jQuery; We're talking about just a couple of lines of JS, compared to a line of HTML.

 

Also, you do not help anyone "better understand the differences in a simpler manner" by posting wrongful information, you're doing the opposite. As for whom is confusing the OP, I leave that up for him/her to decide.

What I do know, is that attacking other people for pointing out your mistakes is not the best way to gather support. Rather the opposite.

 

Edit: I'd also like to leave you with the following quote, from the article "How To Ask Questions The Smart Way"

... If you find this attitude obnoxious, condescending, or arrogant, check your assumptions. We're not asking you to genuflect to us ? in fact, most of us would love nothing more than to deal with you as an equal and welcome you into our culture, if you put in the effort required to make that possible. But it's simply not efficient for us to try to help people who are not willing to help themselves. It's OK to be ignorant; it's not OK to play stupid.

A highly recommended read for everyone frequenting a forum, whether you're there to ask for help or not.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.