GetSimple Support Forum
Prevent deleting component with empty content - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: Prevent deleting component with empty content (/showthread.php?tid=2114)



Prevent deleting component with empty content - phpsns - 2011-08-30

How can I prevent a component to be deleted if there is empty content when clicking "Save Components"? The reason for this is that I don't want the "sidebar" component to be deleted, even if it's blank, to avoid confusion to the users.


Thanks!


Prevent deleting component with empty content - phpsns - 2011-08-30

Okay, this solved. I see I can add conditions to the line 45 in the file

components.php


thanks Smile


Prevent deleting component with empty content - getsimplethemes - 2011-08-30

Perhaps changing one of the core files is not the best solution? If you were to update GetSimple, this change would be lost anyway. Did you try inserting a space or html space entity (&nbspWink into the component? No idea wether it would work or not, but it might be worth a try!

- Matt


Prevent deleting component with empty content - ccagle8 - 2011-08-30

agreed with Matt... you might be able to get away with a comment in there as well:
Code:
<!-- empty component -->



Prevent deleting component with empty content - phpsns - 2011-08-31

Thanks for the replies, I didn't want it get deleted automatically even if there aren't any contents. My clients won't be able to know about inserting

Code:
&nbsp;

or

<!-- comment -->

So I've changed the condition from

Code:
if ( ($title[$ct] != null) && ($value[$ct] != null) ) {

to

Code:
if ( $title[$ct] != null ) {

so it will only verify the title, not the content, thanks!


Prevent deleting component with empty content - ccagle8 - 2011-08-31

I think this should be default. If it has a title it should stay.