darkcarnival Posted January 6, 2007 Share Posted January 6, 2007 hi,I'm working on a program of mine and I'm trying to make it more user-friendly.one item my users have mentioned is when an error occurs when filling out a form they have to re-fill out the form again when they go back.so how can i solve that?what I'd like to do is for example how gmail does it where the error message appears next to the incorrect or missing form field or on top of the form.but i dont know how to do that.thats just one way i can go with this, but if anyone can give me some direction on how to about that, it'll really help me out.thank you :) Quote Link to comment https://forums.phpfreaks.com/topic/33040-error-reporting-help/ Share on other sites More sharing options...
papaface Posted January 6, 2007 Share Posted January 6, 2007 One way you could do it is store the information that was entered in previously in variables or just use $_POST and then have the same form on the same page, rather than clicking back, but in the input field make the values equal the variables. Quote Link to comment https://forums.phpfreaks.com/topic/33040-error-reporting-help/#findComment-153931 Share on other sites More sharing options...
Jessica Posted January 6, 2007 Share Posted January 6, 2007 On your processing page, store all the info that was POSTed into an array, save the array in the SESSION and save the error in the SESSION. When you go back to the page, print the error. Get the array out of the session, and put the values in the value="" part of the html. (for textareas you just print it between the two tags, no value tag) Quote Link to comment https://forums.phpfreaks.com/topic/33040-error-reporting-help/#findComment-153933 Share on other sites More sharing options...
curtis_b Posted January 6, 2007 Share Posted January 6, 2007 jesirose is right on, in addition, it is helpful to have javascript validate the form onSubmit, and manipulate the appropriate DOM elements with error messages for any fields that do not validate, otherwise, if everything checks out > submit. Validation in both js and php for one form is common. Curt Quote Link to comment https://forums.phpfreaks.com/topic/33040-error-reporting-help/#findComment-153943 Share on other sites More sharing options...
darkcarnival Posted January 6, 2007 Author Share Posted January 6, 2007 hmm ok, I like the ideas you guys have posted.I'll experiment around and see what works.thanks.if anyone else has any other opinion feel free to post it ;) Quote Link to comment https://forums.phpfreaks.com/topic/33040-error-reporting-help/#findComment-153947 Share on other sites More sharing options...
darkcarnival Posted January 6, 2007 Author Share Posted January 6, 2007 just thought of something..what if i tie in css with this?have a div tag that contains the error message but use css to hide those div tags until a js app will call them.would something like that work?i used that method for a menu script and it works perfectly. Quote Link to comment https://forums.phpfreaks.com/topic/33040-error-reporting-help/#findComment-153977 Share on other sites More sharing options...
emehrkay Posted January 6, 2007 Share Posted January 6, 2007 google uses ajax -its pretty easy once you get it down.js validation is easily compromised, make sure you do server-side as well Quote Link to comment https://forums.phpfreaks.com/topic/33040-error-reporting-help/#findComment-153980 Share on other sites More sharing options...
darkcarnival Posted January 6, 2007 Author Share Posted January 6, 2007 thats a given yes ;)though a user-friendly display is what i'm trying to do as now its a real basic message and then the users get upset at me as the form data is lost and they have to re-fill the info.I'm still bouncing ideas around, trying to mix css,js/ajax, and php to make this work with ease. Quote Link to comment https://forums.phpfreaks.com/topic/33040-error-reporting-help/#findComment-153997 Share on other sites More sharing options...
darkcarnival Posted January 7, 2007 Author Share Posted January 7, 2007 edit: nevermind I figured it out. had to re-think the process. Quote Link to comment https://forums.phpfreaks.com/topic/33040-error-reporting-help/#findComment-154702 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.