Welcome Guest, Not a member yet? Register   Sign In
Processing the user's input and changing it
#1

[eluser]Silviu[/eluser]
Hello,

I need some help getting this through.

The setup:
- I have a "multilanguage" site: the users can post articles in English and provide their own translation in several other languages.
- I have provided an interface to facilitate the translation: the user has a "translate from English" link under the "another language" pane that they can click and a small AJAX/Google translate script will give them a rough translation in the specified language. This works fine.
- I have provided a checkbox "autotranslate empty articles (on save)". The idea is that if the user clicks "save" without any text entered in the translation box, the text is automagically translated to the specified language on the user's behalf. The translation works fine too.

The problem:
- When the user clicks "save", the text is translated and the database is updated correctly, BUT how do I show the translated text instead of the original (which is "no text") information the user posted when the form is shown again? Because, ATM, I use set_value('field', $article->field) to get the text for the translation panel, which would have worked fine if the user input was not to be processed on the server.

The solution:
- :grrr:

Using plain PHP I would have updated the POST array with the correct text and use that to show it on the form. But is there any way to do it "CI way"?

ATM I've patched the situation by booting the user to a intermediary "your post was saved" page, and then to the articles list. But this is ugly as hell.

P.S. Hope I was clear enough. I can provide a more detailed/technical data if needed/on request.




Theme © iAndrew 2016 - Forum software by © MyBB