<![CDATA[ Ajax replacement for templateWarning function - My Forums]]> https://forums.modx.com/thread/?thread=34833 <![CDATA[Re: Ajax replacement for templateWarning function]]> https://forums.modx.com/thread/34833/ajax-replacement-for-templatewarning-function#dis-post-190810
Wouldn’t mind seeing the code you added. Since I’ve been playing around with the templateWarning function, it would be interesting to see what you’ve done with it. smiley

Jeff]]>
Bravado Jun 27, 2005, 07:33 PM https://forums.modx.com/thread/34833/ajax-replacement-for-templatewarning-function#dis-post-190810
<![CDATA[Re: Ajax replacement for templateWarning function]]> https://forums.modx.com/thread/34833/ajax-replacement-for-templatewarning-function#dis-post-190809 Quote from: Bravado at Jun 27, 2005, 09:56 PM

As many have probably read from sottwell, there’s definitely some areas in the code that could use an Ajax treatment.? One of these is the templateWarning function in mutate_content.dynamic.action.php, which I worked on a bit to keep all the form options from disappearing whenever you changed the template.? Anyways...

I’ve been playing around with the idea of replacing the templateWarning function with an Ajax driven version.? It’s definitely possible...but might prove to be a little tricky in some areas.? A handful of variables in the SQL and output code for the template variables would likely need to be reworked to allow for variables from a $_GET statement.? Plus, functions from tmplvars.inc.php and tmplvars.commands.inc.php would need to be referenced in a separate file that is called from a javascript function rather than being part of the mutate_content.dynamic.action.php.? Might be doable...but I’ll have to play with the code a bit and see if I can get a working version that’ll act as a beta replacement.? I’m still not sure if the javascript will allow for output of an HTMLArea TV or not...guess we’ll see!? smiley? More to come...

Jeff

Hi Jeff,

Since our last discussion about the templateWarning and using $_GET I’ve added a few lines to the code that does a simple post back and merge the posted data with content loaded from the database.

This works just like a save. Restores the RTE content, etc. As for TVs I think I’ll leave those off the list because changing a template changes the TVs

Ajax is also a good way to send data back and fort but IMO maintaing a viewstate will allow you to persist the entire content of the page much eaiser than you can with Ajax. Have you ever used ASP.NET’s viewstate? It’s not very efficient but it’s very flexible. Maybe a combination of both should do the trick.
]]>
xwisdom Jun 27, 2005, 06:42 PM https://forums.modx.com/thread/34833/ajax-replacement-for-templatewarning-function#dis-post-190809
<![CDATA[Ajax replacement for templateWarning function]]> https://forums.modx.com/thread/34833/ajax-replacement-for-templatewarning-function#dis-post-190808
I’ve been playing around with the idea of replacing the templateWarning function with an Ajax driven version. It’s definitely possible...but might prove to be a little tricky in some areas. A handful of variables in the SQL and output code for the template variables would likely need to be reworked to allow for variables from a $_GET statement. Plus, functions from tmplvars.inc.php and tmplvars.commands.inc.php would need to be referenced in a separate file that is called from a javascript function rather than being part of the mutate_content.dynamic.action.php. Might be doable...but I’ll have to play with the code a bit and see if I can get a working version that’ll act as a beta replacement. I’m still not sure if the javascript will allow for output of an HTMLArea TV or not...guess we’ll see! smiley More to come...

Jeff]]>
Bravado Jun 27, 2005, 04:56 PM https://forums.modx.com/thread/34833/ajax-replacement-for-templatewarning-function#dis-post-190808