Hi everybody :-)
I'm working with latest chronoform and joomla 1.5.7...
I've built a form witch use javascript to limit textarea to 4000 chars.
Everything's okay but I need a server validation for people trying to deactivate javascript or simply use a browser that don't support it fully.
The problem is :
If i submit this form with a fully loaded textarea of 4000 chars then the server tell me this is too much !
I've tried a lot : strlen() mb_strlen($string,'UTF-8'), stripslashes before counting chars...
everytime my variable is over 4000...
So I understand it has to do with what append to the data before the validation script run...
Somebody has an idea about this ?
Thanks very much if you can help...
Hi gilloux7,
did you try the server validation in Chronoforms ? you can count the posted string from this textarea and display some error ?
regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi Max,
This is exactly what I do !
I put my validation code in the right tab but mb_strlen() php function returns more chars that's expected...
I suppose chronoforms add something in the textarea before the validation script...?
Hi gilloux,
Is the problem that mb_strlen counts multi-byte characters as '1'? The Notes in the php manual suggest using mb_strlen($string, '8bit'); to count the byte length.
Bob
Hi Bob,
The problem is that my javascript counts correctly the numbers of chars in the textarea but php on the validation side, counts more ! So I think mb_strlen count enough chars... something adds a few things in the texarea before the validation script I guess...
Thanks for your answer guys ! I feel less alone with this strange problem !
Hi gilloux,
I don't think that anything is added - at least not deliberately :-(
Bob
Hi gilloux7,
I don't see any errors in there . . . do you get any line numbers in the error message?
Bob
you may try to test the mb_strlen and strlen with some defined string first and see how they behave ? its hard to test with the real data directly if you got a problem like this.
Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi gilloux,
I suspect that chr() is now case-sensitive and that Chr() is giving you the error.
Bob
Thanks bob but it's not... still got the error !
When I comment the str_replace() lines the error disapear (whatever the syntax), Developpers be aware of that !
I think I've found a new bug..
Does anybody master the ereg function to replace.. str_replace ?!
I just want to remove the \n\r from the textarea before the counting...
thanks
Hi gilloux7,
why do you want to replace str_replace with ereg ?
try to use the function nl2br then replace the <br> with str_replace ?I'm not sure this will work, but let me know!
Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Ok max
I probably have some difficulty to make me understood cause english is not a usual language for me..
whatever the syntax with str_replace I have a syntax error so I thought chronoform have some difficulty with this function...
I definitly have a syntax error only with the str_replace used on the validation side... And I'm sure of the syntax though, I tried on differents server too...
So I want to try with an ereg function to confirm my diagnosis...
try to echo the $full in a textarea after submit and see what does it have exactly ?
regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi gilloux,
I have no idea what the problem is any more, neither of your last two posts made any sense to me.
Please post some real examples saying exactly what is happening and we may be able to help you.
Bob
Well thanks bob !
I understand, too long time between posts...
I think i'm about to find a solution for my problem... not sure I'll tell you.
Thanks again !
Hi Max
Do you mean this ?
echo '<textearea>'.$full.'</textarea>';
the result is that the code is not parsed... I see the php code in the resulting page !
do you put it inside PHP tags ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.