Edward Posted April 8, 2013 Share Posted April 8, 2013 I have something i am trying to figure out. I have some hide and show division blocks on one of my yii forms. Now the problem is if i click on the form in real-time to say show a division block, when i submit the form and the validation does not clear because some model attributed are required the division block can now not be seen which means they are reset. So how to save the state of the jquery on the page after the submission of the form has been processed? Link to comment Share on other sites More sharing options...
Edward Posted April 8, 2013 Author Share Posted April 8, 2013 jQuery.localStorage() That should do the trick. Thanks. Link to comment Share on other sites More sharing options...
Larry Posted April 9, 2013 Share Posted April 9, 2013 Thanks for sharing that, Edward. Sorry I didn't get a chance to chime in on it. Link to comment Share on other sites More sharing options...
Edward Posted April 9, 2013 Author Share Posted April 9, 2013 No problem, btw have you ever used that function before? Once you finish that Yii book ill buy another one. Link to comment Share on other sites More sharing options...
Larry Posted April 10, 2013 Share Posted April 10, 2013 I have not used that function, no. I'm glad to hear you said you'll buy another book, though, considering how long this one has taken! Link to comment Share on other sites More sharing options...
Edward Posted April 21, 2013 Author Share Posted April 21, 2013 I decided in the end not to use this method as it doesn't work out with my current situation. Here was a good doc i found if anyone else was interested. This already comes with HTML5 so you don't need the Jquery plugins. http://www.simonbingham.me.uk/index.cfm/main/post/uuid/using-html5-local-storage-and-jquery-to-persist-form-data-47 1 Link to comment Share on other sites More sharing options...
Larry Posted April 21, 2013 Share Posted April 21, 2013 Keep in mind that the HTML5 local storage only works if the browser supports HTML5. It's pretty good right now, with IE 7 and earlier being the biggest omission http://www.html5rocks.com/en/features/storage 1 Link to comment Share on other sites More sharing options...
Edward Posted April 23, 2013 Author Share Posted April 23, 2013 Thanks for that that was a more informative link than mine. I am having to deal with a lot of tabular data in yii it's quite difficult but I'm getting there slowly. I was having trouble with adding new inputs as HTML the problem was the events were not blinded to the new HTML so one way I got it to work was by cloning then changing attributes of the elements. If I added HTML manually I had to add the events again manually which led to a lot of code. Link to comment Share on other sites More sharing options...
Antonio Conte Posted April 23, 2013 Share Posted April 23, 2013 One quick question to your YII guys: Do you use the forms helpers and other output factories, and why? Link to comment Share on other sites More sharing options...
Recommended Posts