dijona Posted June 18, 2010 Share Posted June 18, 2010 I'm wondering if anyone has any tips for saving a form state on reload? I know it can be done with JavaScript and cookies but I've got a hierselect element (2nd dropdown is dependent on selection from 1st dropdown) that seems to throw a wrench in things. Is there something built into quickform? anyone done something like this? Quote Link to comment Share on other sites More sharing options...
ram4nd Posted June 18, 2010 Share Posted June 18, 2010 This is pointless, use ajax so you don't need refresh. Quote Link to comment Share on other sites More sharing options...
dijona Posted June 23, 2010 Author Share Posted June 23, 2010 Well that's not actually that helpful. I know I'm a noob and all but... Â Well, i've managed to work out a few things, but I'm still stuck. Â Ok, here's the thing. I've got the form in PHP. some of the values are pre-populated text fields that use session variables and variables to hold the content. i.e. (PHP is just jotted down as an example..i know there are errors) Â snip... $myMSG = $_SESSION['Book']." ".$_SESSION['Chapter']; echo "<form...>"; (form stuff...) echo"<textarea name='message'>$myMSG</textarea>"; etc... <input type=\"submit\" value=\"Send Message\"> echo "</form>"; Â I've got some basic error-checking that validates the form. If it fails, It prompts the user to enter the missing/incorrect data. The problem is - when the form reloads, $myMSG is gone. Â So is this because my session data is being deleted on the submit? Is there any way I can have the form reload and still keep the value in $myMSG? Â thanks in advance! Quote Link to comment Share on other sites More sharing options...
ram4nd Posted June 24, 2010 Share Posted June 24, 2010 are you setting the session variables somewhere? Quote Link to comment Share on other sites More sharing options...
dijona Posted June 24, 2010 Author Share Posted June 24, 2010 yes, as I said it's just a snippet of code. Â the form displays fine with all the session variables - it's only when form validation fails (i.e. user didn't enter the email-to: field) and the form reloads that the session variables are lost. Quote Link to comment Share on other sites More sharing options...
ram4nd Posted June 24, 2010 Share Posted June 24, 2010 well we still need that code, so it would be nice to see all of the code. Quote Link to comment Share on other sites More sharing options...
dijona Posted June 25, 2010 Author Share Posted June 25, 2010 well I'm travelling so I don't have the whole code. I really thought the sample would be more than sufficient to let people know basically what's going on. The basic question, again, is: If I populate a form field with a session variable - submit the page - everything works great. BUT, if the form fails validation and reloads so user can enter/correct data - why does the field containing the session variable data disappear, and what can I do about it? Quote Link to comment Share on other sites More sharing options...
ram4nd Posted June 25, 2010 Share Posted June 25, 2010 Well something is wrong with the session, can't tell if i can't see the code. Quote Link to comment 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.