-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plain error messages #18
Comments
I think it's awesome that we can put up these issues here, I might not have an idea for approaching a challenge but I'm able to document some thoughts and help keep track of things, it's great to be able to contribute in some way still hehe. And others can see it, and they might have some of their own ideas 😃 |
Wow ooh being able to reorder the items in the checklist, that's pretty nifty 😎 |
oh hmm I noticed that we can use |
There's certainly a few different ways of doing most of them. Some might be able to be done entirely in the backend (eg, if the user isn't logged in, just don't show them the comment box. Otherwise, using some AJAX techniques might be the way to go for a few of them (create a python script to fulfil a specific purpose such as checking if a username already exists, then when the user starts typing, use jquery to send a POST request to that python script, retrieve the result and then continue validating using js). It might be a little complicated at first, but it's a cool thing to try and figure out. |
Maybe putting a handler on "keyup" which waits a few seconds before sending an Ajax request (http://stackoverflow.com/questions/4220126/run-javascript) |
hmm how do I reference a commit like 4831b08 |
I'm gonna try applying @Jackywathy's ajax techniques for some other error messages :D |
@Jackywathy hey Jack :D I was just wondering for the keys in this dictionary: are the same ones as here on this reference site? http://api.jquery.com/jquery.ajax/ |
yep should be, i just copied it off the book |
but make sure your passing $input.val(), not $input, cuz it gives you max recursion error if you dont |
cool thank you! oh do you mean the rapid web dev book? I should check that! oohh, oh noes thanks for the heads up! 👍 |
for the method we put in |
yep! <form class="sign-in" action="/signup" method="post" enctype = "multipart/form-data"> && $.ajax("/ajax/user_validate", {datatype: "json", type: "post", data: {username: $username.val()} I think its get by default though |
oooh okay thank you so much!! :DD |
@Jackywathy oh noes I think I'm getting plain error message for |
ooo thats not good :( it means that the handler is not returning anything. Ill have a look at it in a sec |
oh @Jackywathy I just saw this 🤔 check the changes in @ninjaprawn's latest commit to (I would link and take a closer look but I'm off for now 😴 night!) |
got the link! see here 153542b hehe sorry if this is appearing in everyone's mail, whoops... 😅 |
I have another idea
(see sign up page here for idea https://try.discourse.org :P) e.g. 'Username is available' 'Valid password' 'Valid nickname' |
wew I was just about to redirect /view/12345 to the 404 page (did it in commit a4ccecb) but just saw your changes in be33400 @Jackywathy Great idea with the error page :DD oh I think the changes don't clash though yay :)) |
yay did the same for profile pages — redirects to 404 when you go to a profile that doesn't exist commit 01fbde5 @StiffKelly I love our 404 page by the way hehe 😛 👌 |
For example if you go to /view/100000000 it will now redirect to 404 Issue #18
Before, using ajax to tell if user logged in wasn’t working. Turns out it was just a misnaming thing all this time (!) ;<
@Jackywathy thanks for all the ajax help :DD |
Now error message appears as soon as you lose focus on the username field For issue #18 Plain error messages TODO: - disable Submit button if username not valid - check if fields are empty (set ‘required’ attr)
@Jackywathy I love this error page :) |
weew recent commits to dev have been addressing the stuff for the sign in page |
Changed ‘username cannot be found’ and ‘username and password do not match’ to show on page using template language (rather than ajax) (Why not live error messages using ajax? Cuz rate limiting :stuck_out_tongue: woah since when could I put emojis here??) Will probably do a quick clean up in next commit
Error message displays on page for if you upload a file as your profile pic, but the file isn’t an image
- ‘Uploaded file type not supported’ and ‘We could not find an uploaded file’ now appear on page - Also fixed pic file paths on /ask page (this is for images that don’t end in .jpg :) ^_^)
okay I think the main things are done
should I store these in a new issue? maybe I will also would like to add that @Jackywathy error pages are very cool :DD |
Awesome that we have descriptive error messages coming up to notify users 👍
Some of them come out as plain on a separate HTML page. It's not a bug - it's done intentionally - but @liamcal suggested we could add to the UX for those 🙂
Here is a pic:
List of error messages that come out as plain on a separate HTML page:
Username already exists
after you choose a username that is already taken/if you choose a username that is not unique, on sign up page (user.py
).Thanks to @Jackywathy on set up ajax on serverside and just-in-time testing for unique usernames
Email is already registered
if the email you use is already in the dbAgain thanks to Jack! here in this commit 1f59c7e
Username and password do not match
from sign in (user.py
)Username cannot be found
from sign in (user.py
)Uploaded file type not supported
when image type for uploaded profile pic or post image is not valid (user.py
,ask.py
)signup page fix e09d7d9 & ask page fix 7f73aeb
We couldn't find an uploaded file
if no image is uploaded to post (,user.py
ask.py
)edit: profile pic isn't necessary on sign up. fixed for ask page 7f73aeb
You are not logged in
if you try to post a comment without being logged in (view.py
)Yay d19d596 It prevents you from posting a comment in the first place if you're not logged in.
Actually something we could do here is not allow the user to post a comment front end (disable input field or anything) if there is no user_cookie, I'll look into that.
Username is not in db
if you try to go to a URL of a profile that doesn't exist (profile.py
)The file name in brackets for items in the list indicates in which file(s) the message is being written. (I haven't actually gotten to verify these yet, I've only gone and looked in the files under
/back-end
)These come from the lines
request.write()
. For example, inback_end/user.py
:I quite like the idea of live error messages that display right when you make the mistake, hehe.
For example, I had changed it so that error messages appear live for the signup page, but that was adding onto @jackfrench's code using jQuery for validation of signup details 😃 I just found out that using JavaScript it's possible to change the text in the elements with
class=error
I'm not sure how to take into consideration things from the database though — for example, to display an error message saying that a username is already taken on the sign up page, we need to check in the database.
And then if we wanted to make it a live error message (personal taste hehe), we'd need to be able to change the content on the HTML page, and I think there would be a way to do that...? but I am not sure hmm. Maybe sounds like using template language can do that? I'll have to look around for using the template language 🙂 (haven't gotten to see it in action much actually 😛)
EDIT:
Places where we could add an error message:
/view/10000
won't exist unless you create 10,000 posts), it should redirect to/404
. That would require checking the largest post_id in the db though before redirecting(e.g. if the largest post_id is only 10, there won't be more than 10 posts. So if someone tries to go to `/view/10000` it should take them to `/404` instead)
The text was updated successfully, but these errors were encountered: