Set the value of "set_value" in controller |
[eluser]darytas[/eluser]
Hi, first at all, I really enjoy CI. I tried CakePHP and Zend, but they sucked compared to CI (bigger isnt alway better, right?). So, I'm developing in a medium-sized company, currently on a project, related to mobile message service. Whatever, I stuck at the following problem: (created some screenshots, but all of those are in german.) - A user should enter some information (for a mobile message) - http://i387.photobucket.com/albums/oo317...orm_01.png - The user can submit (Absenden) or preview (Vorschau) the mobile message: - http://i387.photobucket.com/albums/oo317...orm_02.png So, my idea to create this form was the following: - Submit the form and create an array - Check if the preview button was clicked and decide with view to load Code: $smsdata = array ( 'senderid' => $this->input->post('senderid'), This stuff is working fine, but my problem is... how to get the values I got into the preview, back into the "editable form" if the user decides to edit the data currently available within the preview? I hope my english is understandable! ![]() Thanks! darytas
[eluser]pilotLight_Tre[/eluser]
There are a few ways to get this done: 1) Store the array in a "flash" session. Example: Code: // set the session data 2) Create a table to store temporarily "smsdata" values. Just delete the entries once the data has been published/finalized. 3) Use the Form Validation library. You have to load the library in order to use the set_value method. Just make sure you set the rules to all of the fields that you want the set_value method to display the temp. data even if the fields aren't required. Else, it'll display a blank field. http://ellislab.com/codeigniter/user-gui...ation.html Hope this helps. Good luck!
[eluser]darytas[/eluser]
Hi, thanks, maybe I should have to define the question more in detail. Is there a way, to set the value of the "set_value" of a specific field within the controller? I got an array with 8 values (the one above) and want to associate i.e.: $smsdata['message'] with '<input type="text" name="message" value="..." />'. $smsdata['recipients'] can be an array which need to be associated to a '<select multiple>'. |
Welcome Guest, Not a member yet? Register Sign In |