Forums

Add prefix to submitted values inside POST request

AloneAngel 23 May, 2015
Hello,

I'm wondering if it's possible to add prefix to all the values that correspond to my submitted form and not to mix them with parameters from other modules.
My situation is next: for the user profile I'm using "profiler" module and on the very same page I got form from chronoform.
Everything looks OK but the problem appears during the process of submission: after the submission "profiler" module adds explicitly 'id' parameter to $_POST array (this is the way it defines users). Because of this 'id' parameter being added to POST request, chronoforms thinks that this is an id that it need to use for submission and it tries to 'UPDATE' corresponding value with id=1, which actually doesn't exist.
So, instead of having 'INSERT' statement, chronoforms tries to 'UPDATE' inexisting one, because 'profiler' module has cheated and added 'id' param.

My idea was to try to add prefix to all the values that correspond to chronoforms, so it won't mix with other parameters.
Do you have any ideas regarding this?

Kind regards,
Dmytro
GreyHead 23 May, 2015
Answer
1 Likes
Hi Dmytro,

The simplest solution may be to rename the id column in your ChronoForms table to say cf_id - that should avoid the problem with the ids conflicting.

Bob
AloneAngel 23 May, 2015
Oh, really? It's as easy?
Great. I will give it a try.
I thought that 'id' is hardcoded somewhere...

Thank you very much, Bob.
Have a nice day.
AloneAngel 23 May, 2015
Hi, Bob,

I've tried your solution but I'm having a problem with cache.
My $this->pkey is being loaded from the cache:
if(Base::getConfig('cache') >= 1 AND Base::getConfig('cache_dbinfo') >= 1){

I've tried restarting server and purging cache from Joomla admin panel but this didn't help.
Could you advise how to delete cache, please?

Kind regards,
Dmytro
AloneAngel 23 May, 2015
Pffff, how could I miss it?
There's button "Clear Cache" directly in the Chronoforms Management menu".

Thank you, Bob, your solution works like a charm😉

Kind regards,
Dmytro
GreyHead 24 May, 2015
Hi Dmytro,

It's not clear what the 'Delete Cache' icon does - ChronoForms caches the database table info for 24 hours so if you change anything in a table you need to click the icon to have the change 'noticed' by CF.

Bob
This topic is locked and no more replies can be posted.