Buttons to save data
3 posts by 2 authors in: Forums > CMS Builder
Last Post: January 7, 2013 (RSS)
Hi,
I am trying to create a "cancel", "save and continue editing" and "save and exit" button on a custom front-end user control panel I am designing for CMS Builder.
I have used the following code and it works but it's not very elegant:
<a href="javascript:void(0)" class="button button-red"><span onclick="window.location.href='./dashboard.php';">CANCEL</span></a>
<a href="javascript:void(0)" class="button button-green"><span onclick="document.getElementById('hid').value='save';document.getElementById('hid2').value='exit';form1.submit();">SAVE & EXIT</span></a>
<a href="javascript:void(0)" class="button button-green"><span onclick="document.getElementById('hid').value='save';document.getElementById('hid2').value='stay';form1.submit();">SAVE & CONTINUE EDITING</span></a>
The problem is that when the user clicks the "save and continue editing" button, the page reloads, displays the old data and then reloads again to display the newly saved data.
Ideally when the button is clicked the page will just reload the once and display the new data.
I would be grateful if anyone could help me improve this.
Thank you,
Greg
By Jason - December 31, 2012
Hi Greg,
Can you provide some extra information on how you are setting this up? Can you show code that handles the different values for "hid2"?
Let me know and I can take a look.
Thanks
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
By gversion - January 7, 2013
Hi Jason,
Thanks for getting back to me on this. A friend of mine seems to have resolved this for me but I am not sure what he did...
I will update the post if I can find out so that others can benefit.
Regards,
Greg