Forums

Submit article with plugins tags in it

jrchukalescu 06 Dec, 2014
Hello everyone,

I have a form which saves users information into a custom DB with the DB Save action. Once this is done, I would like to submit an article. This article will be quite simple as both the intro text are just plugins tags which will be processed by a custom plugin of mine when the article is displayed. Therefore, I used 2 hidden field inputs to store them:
- input_introtext with a default value of <p>{myplugin1}</p>
- input_fulltext with a default value of <p>{myplugin2}userid{/myplugin2}

But when I check with a debugger action what the form submits, I can see that the plugin tags are removed.

When is this done? Can I change this behavior?

Thanks for your answers...

JR
GreyHead 06 Dec, 2014
Answer
Hi JR,

The problem here is that ChronoForms is - at some point - trying to replace any strings in curly brackets with the values of matching form inputs. In this case there are no matching input names so it just removes the string.

Two things that you might try, one is not to use hidden inputs for these but just define them in a Custom Code action immediately before the Submit Article action:
<?php
$form->data['input_introtext'] = '<p>{myplugin1}</p>';
$form->data['input_fulltext '] = '<p>{myplugin2}userid{/myplugin2}</p>';
?>
That will reduce the number of places where the replacement might take place.
If that doesn't work you can try the same code using HTML entities:
<?php
$form->data['input_introtext'] = '<p>{myplugin1}</p>';
$form->data['input_fulltext '] = '<p>{myplugin2}userid{/myplugin2}</p>';
?>
That has worked in another context - I'm not certain if it will work here though.

Bob
jrchukalescu 07 Dec, 2014
Thanks Bob,

I suspected something like that was going on, so I tried the exact same solution that you proposed...

First solution worked perfectly...

Great extension by the way...
This topic is locked and no more replies can be posted.