Bug #16164
closed
Old Gremlin: Mail Form validation: solution of wrong Russian chars in JS pop-up
Added by Valery Romanchev over 18 years ago.
Updated about 14 years ago.
Description
There is extension to correct this problem:
------------------------
Correct Form (onet_correctform):
When MAILFORM using with differ from English language (for example - Russian) there is problems occur connected with necessarily fields. When necessarily fields is not filled, JavaScript "formValidate" shows form labels after processing rawurlencode() function which distorting labels when they shows on alert-window in turn. This extention are using parallel array, where rawurlencode() is not in use, and labels outputs to validateForm JavaScript in clean sight. This extention actual for Typo3 3.7.0.
------------------------
But IMHO better to correct this problem in TYPO3 Core
Solution (thanks to Kit from forum www.typo3.biz)
Patch for t3lib/jsfunc.validateform.js
function validateForm(theFormname,theFieldlist,goodMess,badMess,emailMess) {
var formObject = document[theFormname];
// patch start
theFieldlist = decodeURI(theFieldlist);
// end
if (!formObj............
(issue imported from #M3527)
Files
I'm not sure what happens in TYPO3 4.0 in the FE. In the BE all rawurlencode/unecapse pairs have been removed. This should also happen in the FE as it is only needed for very old browsers.
AFAIR using decodeURI only works if the charset is UTF-8 as it is this what the functions does: convert an UTF-8 string that is escaped (with %) into the local charset of the page. So TYPO3 must deliver UTF-8 to make this patch work.
I could confirm the problem with TYPO3 4.0 with UTF-8 in FE.
onet_correctform does fix the problem!
Why not to integrate it in the core?
Also badMess, goodMess and emailMess need to be properly decoded as these texts may also contain foreign characters. For example I'm having problems with emailform estonian strings containing äöüõ. decodeURI() helps as I use utf on site.
This is patched version of t3lib/jsfunc.validateform.js
that solve this problem for utf8
The patch is not present neither at 4.1 Beta 3, nor at trunk from today.
Would it be fixed until 4.1?
guys, please add this patch to the core
I just had attached unified diff. Maybe it will help for commiting patch.
I have tried it with typo3-trunk from today (RC2) - it works.
Please, commit this change.
Please, take a look and create SVN patch request for this simple change.
Can some of Russian-speaking people provide an example of mailform configuration here (with russian chars)? Before doing so, switch browser charset of the page to windows-1251 or utf-8, please.
Here is it (in UTF8):
=======================================
- Example content:
имÑ: | *name = input,40 |
Email: | *email=input,40 |
Сообщение: | *message=textarea,40,5 |
СвÑзатьÑÑ Ñо мной: | tv=check | 1
|formtype_mail = submit | Send form!
|html_enabled=hidden | 0
|subject=hidden| This is the subject
=======================================
Patch works well, I will send it to core team list
thank you very much, Dmitry
Patch is recalled due potential problems with various non-unicode encodings.
Why? Isn't it better to fix at least for UTF-8 sites instead of not fixing for all?
No, it is not better. Fix must not introduce new errors. This is a general typo3 rule.
The accompanying tslib_content-validateForm.diff will make patch3527.diff work for all charsets.
Note: that using decodeURI will break ancient browsers (but so does a getElementById).
Was this patch applied? Cause I did not see it applied in TYPO3 4.1.2.
That's great, we publish a patch which only needs a blink of an eye for a core developer to integrate you set it to duplicated and close it.
It's a old gremlin it's a bad bug it's fixed, so why doesn't it go into core?
It's great that your cleaning up the bugtracker so consequently but it would be also cool if you could integrate the working patches.
The working up to date tested patch (which not only fixes this problem) is located here:
http://bugs.typo3.org/view.php?id=5615
It seems enough to call decodeURI() on the field names, since field names are encoded with rawurlencode() in tslib_content.
Attached a new patch, submitted to the core list.
Committed to trunk (rev 5535)
Also available in: Atom
PDF