JC5 Posted October 4, 2008 Share Posted October 4, 2008 I have a ajax login script on my site and i am trying to get it so wehn i enter the credentials it will remove the login form and display welcome (and then the persons first name). the link is www.devwebsites.com and (so i dont flood this post with code) the links are in the head section of my home page. Thanks Link to comment Share on other sites More sharing options...
Jesdisciple Posted October 4, 2008 Share Posted October 4, 2008 The tab thing isn't working for me... (And I hope you have a submit button that you remove from the page with JS; otherwise it's inaccessible without JS.) Link to comment Share on other sites More sharing options...
jeffman Posted October 4, 2008 Share Posted October 4, 2008 1. I'm not sure what your question is.2. The tab thing doesn't work for me either. And a billion web users are gonna get confused that you're making them use tab to login when they're used to hitting the return key. Stick with the UI people know.3. Are you asking about the showLogin() function?a. Do you know if it gets called? Have you stuck an alert in there to see?b. The showLogin() code demonstrates perfectly why the W3 chose to include the innerHTML property in the HTML 5 specification. I mean, yuck. Nothing personal. It's a valiant effort at using pure DOM methods, but this is exactly the place where the brick hits the fan. I know because I've been there. Link to comment Share on other sites More sharing options...
JC5 Posted October 4, 2008 Author Share Posted October 4, 2008 I'm asking (well if you could add a login button to the system that would be great cuz idk how) how to change it so when a persons logged in it removes the login forms and displays welcome (persons first name) Link to comment Share on other sites More sharing options...
jeffman Posted October 4, 2008 Share Posted October 4, 2008 I asked about the showLogin() function because it looks like you're already trying to do something like that there. So are you asking us to explain it from scratch or to help you debug something that's not working? Link to comment Share on other sites More sharing options...
JC5 Posted October 5, 2008 Author Share Posted October 5, 2008 I'm asking how to do it Link to comment Share on other sites More sharing options...
Jesdisciple Posted October 5, 2008 Share Posted October 5, 2008 Why are you biting the hand that feeds you? We need to know which kind of "how to do it" to apply. For this post, I'll assume you mean from the ground up.Build the basic login form, with submit button, text fields, and no JS; a PHP page that echo's the data in some format; another PHP page which encloses the first in HTML. Set the second PHP page as your form's action. When the page loads, set the form's onsubmit to a function which uses AJAX to retrieve the first page and returns false. (If you don't want the submit button when it's unnecessary, remove it here.) Put the AJAX data in the page somewhere. Link to comment Share on other sites More sharing options...
JC5 Posted October 5, 2008 Author Share Posted October 5, 2008 Ok try this linkthisa username or password wont work because I still need to put in a register script to add users but i'll update this post when i do Link to comment Share on other sites More sharing options...
Jesdisciple Posted October 5, 2008 Share Posted October 5, 2008 You're building the form with JavaScript; the form itself shouldn't depend on JavaScript. If JavaScript is running, then it can change the form up to be fancy, but until then the form should involve no JS.But you did the AJAX well.EDIT: BTW, Lynx is a good tool for testing your site's accessibility. Link to comment Share on other sites More sharing options...
JC5 Posted October 5, 2008 Author Share Posted October 5, 2008 I'm currently redoing hte entire script to include a register script. I'll edit this post with the current link when done! Link to comment Share on other sites More sharing options...
JC5 Posted October 5, 2008 Author Share Posted October 5, 2008 Ok Guys all done finally! www.devwebsites.com is the url and at the bottom of the page is teh login script. Go ahead and try it! Link to comment Share on other sites More sharing options...
Jesdisciple Posted October 5, 2008 Share Posted October 5, 2008 It works great with JS, but when I disabled JavaScript and submitted the form it just refreshed the page and asked me to login again. Link to comment Share on other sites More sharing options...
JC5 Posted October 5, 2008 Author Share Posted October 5, 2008 I am going to add a <noscript> tag to the top of the page saying that in order to view the page correctly try enabling javascript. Anyway how did you like the script? Did you like the login stuff? try clicking the register link at the top too Link to comment Share on other sites More sharing options...
Jesdisciple Posted October 5, 2008 Share Posted October 5, 2008 You seem to be missing the point: Not everyone can enable JavaScript. For some people, it doesn't even make sense. How would it work for the technologies listed here? And if it did work, would it be confusing?Of course, you can just ignore those problems - but I hope you won't. Good JavaScript programming is intentionally non-essential. (Not that I have that anywhere near mastered, but it's a goal of mine.)But you're right; your scripts work great - when they can. Link to comment Share on other sites More sharing options...
JC5 Posted October 6, 2008 Author Share Posted October 6, 2008 what do you mean not everyone CAN enable javascript. i might include a link to a section telling people how to enable javascript if thats what your saying. its what myspace does. if you disable js on teh screen then it displays you need javascript enabled to view the page correctly. Click here to see how to enable javascript for your browseror something like that :)oh well time to do the register scripts..sigh Link to comment Share on other sites More sharing options...
Synook Posted October 6, 2008 Share Posted October 6, 2008 There are some browsers that can't use JavaScript.And, as JD© pointed out, it isn't in the interests of accessibility to create a site that doesn't work without JavaScript. Link to comment Share on other sites More sharing options...
Jesdisciple Posted October 6, 2008 Share Posted October 6, 2008 Some folks still use very old browsers - I guess because they're extremely computer-illiterate. Others use technologies like those at the Wikipedia link. Still others disable JS as a security measure. Granted, these would probably never find your site (except the last group), given that its audience is developers. But if you're serious about web development you need to know and practice this stuff. (And I wouldn't recommend MySpace as a model site.)Here's some related reading if you're interested: http://www.google.com/search?q=javascript+...R+accessibility Link to comment Share on other sites More sharing options...
JC5 Posted October 6, 2008 Author Share Posted October 6, 2008 Well according to the stats for w3schools 95% of people who enter w3schoosl enable js. I'll just hope people do Link to comment Share on other sites More sharing options...
justsomeguy Posted October 6, 2008 Share Posted October 6, 2008 FWIW, there are a lot of things that do require Javascript now. I'm building a new version of a product my company produces that is nearly all-Javascript. It's a system to launch and track web-based training, classroom training, online tests, etc. Some people might think it's not a good idea to use Javascript for this because it would eliminate people who don't support Javascript, but the training tracking standard itself (SCORM) requires Javascript. There are just a lot of things today that require Javascript, and for a lot of applications it's just easier to say that Javascript is required. Link to comment Share on other sites More sharing options...
JC5 Posted October 6, 2008 Author Share Posted October 6, 2008 I just went to the public libraries website where i live near and their shopping cart like application for requesting books is all in javascript to speed the users abilities to get books. O.o There are just a lot of things today that require Javascript, and for a lot of applications it's just easier to say that Javascript is required.High Five! Link to comment Share on other sites More sharing options...
Jesdisciple Posted October 6, 2008 Share Posted October 6, 2008 I don't think a login form (or anything else on the site in question) is one of those things that must require JS... Link to comment Share on other sites More sharing options...
justsomeguy Posted October 6, 2008 Share Posted October 6, 2008 Maybe not but, depending on the application, there's no point logging in if you can't use anything else.The key phrase of course being "depending on the application". Link to comment Share on other sites More sharing options...
Synook Posted October 7, 2008 Share Posted October 7, 2008 I suppose it is accessibility v usability. But most forums don't need JS enabled to work... Link to comment Share on other sites More sharing options...
JC5 Posted October 7, 2008 Author Share Posted October 7, 2008 I guess your right. Well I guess im more inclined to use JS to prove to myself i have learned stuff. I am currently only learningjavascript (javascript + ajax + jquery) so its pretty extensive, jquery is not an easy language to learn Link to comment Share on other sites More sharing options...
Synook Posted October 8, 2008 Share Posted October 8, 2008 jQuery isn't a language . It is a framework.Well, it would be even better to prove that you can both use JavaScript and allow your applications to degrade gracefully without it Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.