kalster Posted August 22, 2012 Share Posted August 22, 2012 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? Quote Link to comment https://forums.phpfreaks.com/topic/267442-get-the-result-of-a-html-text-box-before-the-submit-is-clicked/ Share on other sites More sharing options...
Jessica Posted August 22, 2012 Share Posted August 22, 2012 You'll need to use AJAX. If you google for AJAX form validation you can find examples. Quote Link to comment https://forums.phpfreaks.com/topic/267442-get-the-result-of-a-html-text-box-before-the-submit-is-clicked/#findComment-1371557 Share on other sites More sharing options...
Eritrea Posted August 26, 2012 Share Posted August 26, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/267442-get-the-result-of-a-html-text-box-before-the-submit-is-clicked/#findComment-1372563 Share on other sites More sharing options...
Jessica Posted August 26, 2012 Share Posted August 26, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/267442-get-the-result-of-a-html-text-box-before-the-submit-is-clicked/#findComment-1372567 Share on other sites More sharing options...
Christian F. Posted August 26, 2012 Share Posted August 26, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/267442-get-the-result-of-a-html-text-box-before-the-submit-is-clicked/#findComment-1372568 Share on other sites More sharing options...
Eritrea Posted August 26, 2012 Share Posted August 26, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/267442-get-the-result-of-a-html-text-box-before-the-submit-is-clicked/#findComment-1372611 Share on other sites More sharing options...
Christian F. Posted August 26, 2012 Share Posted August 26, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/267442-get-the-result-of-a-html-text-box-before-the-submit-is-clicked/#findComment-1372624 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.