Open fancybox after inserting
- Single Page
Posted 24 January 2013 - 19:03 PM
Second. I have a question
I'm creating a page where I have to insert in a table "products" and this product have multiple images. [b]This images paths are not stored in DB[/b], just according with the code of the product inserted, a new folder are created, and the pictures go inside.
The porblem is: I can't in the same page in the add action put a button and open a fancybox, and inside do the [b]multiupload [/b]because the new product are not saved yet, so I don't know the ID (pk) to create a folder.
If I take the max(ID) +1, and use it, the user can open the add page, upload photos and NOT SAVE the product. So, when the next user add another product, the photos will be already there. But from the wrong product.
My try was use a callback "callback_after_insert" and from inside tell to open a new Fancybox window to the user add photos from the product just saved. But any JS that I send to output aparently are not executed.
Someone have a idea so work around it?
Thanks in advance.
Posted 24 January 2013 - 23:57 PM
Posted 25 January 2013 - 12:49 PM
I'm using uploadify (http://www.uploadify.com/demos/)
This button on the side of the text filed where user fill the name of the product, I've added via JS append, and they call to open fancybox.
Posted 25 January 2013 - 14:01 PM
step 1: disallow the 'add' method.
step 2: create an action via the add_action function.
step 3. create a new method in your controller for example 'add_new_row'.
step 4. via that method insert one empty row into table and get the last id. now you have this id.
step 5 : then create redirect to the edit page.
in other words you haven't add page. you have the edit page.
Sorry for my English.
Posted 25 January 2013 - 14:10 PM
Posted 25 January 2013 - 16:48 PM