How to replace textarea input

Status
Not open for further replies.

mattsh

Member
I'm using a Fabrik form to send data to another application (not Fabrik), but the second application is messed up if anyone enter ":" in a Fabrik textarea element. I tested to use a javascript plugin to replace the ":" with ". ", but my javascript skills are not good enough to make it work.

Anyone?

Regards
Matt
 
How does your form send data to the other application?

It may be better to do this via PHP on submit. This gives you the ability to keep the original values if you are storing the data in Fabrik and send the amended version to wherever it's going.

Personally I would look into why the second application doesn't accept the ':' first but obviously I don't know where it's going to. :)
 
Thanks, the second application uses ":" to separate element labels from element values, and it is to hard to change that setting. So I think a javascript or php that replaces ":" with "_" in each text area is the way to go.
 
You could probably use a regex or php validation in "replace" mode to do that.

Although you really need to answer the question Felix has asked twice ... how does Fabrik "send" to the other app. Is it with a redirect, appending form data, or what?

-- hugh
 
Not sure what you mean. Are you using the 'article' form plugin?

Anyway ... try putting a PHP validation on the textarea element, which does:

PHP:
return str_replace(':', '_', $data);

... in the "PHP Code", with "Match or Replace" set to Replace.

You will probably want to set "Show Validation icon" to No as well, and maybe some tip text to let people know that : will be replaced with ;.

-- hugh
 
Thanks, php validation works perfect!

Sorry, that I didn't mention I use email plugin in the form and it uses a Joomla article as template.

Matt
 
Ah, OK. It just helps us provide the most suitable solution, if we have a clear understanding of what you are doing,

Glad that fixed it for you.

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top