• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Council for the text string formatter

georgie

Member
Hello

I would like to format a string, when it is submitted in a form.

This is about two fields name and surname. I wish that all the words are in lower case except the first letter of each word, in upper case.

Where can I implement my code?

I had thought of "input mask" or "format string" from the options of the relevant fields? A PHP code in the form of plugin?

Thank you for all council
 
You can use php validations with replace or a php form plugin (onBeforeStore) with something like strtolower() and ucfirst()
 
Hi

Yes ! It runs but with "Start of form submission - OnBeforeProcess".

I use this code, it runs also with '-', but not for ?, ?, ?...

Code:
$var_name = $formModel->formData['rohm_users___name']; 
$var_lastname = $formModel->formData['extra_fields___lastname_user'];

$formModel->updateFormData('rohm_users___name', mb_convert_case($var_name, MB_CASE_TITLE) , true);
$formModel->updateFormData('extra_fields___lastname_user', mb_convert_case($var_lastname, MB_CASE_TITLE) , true);

But already, it is very nice !
 
I didn't try, maybe $str = mb_convert_case($str, MB_CASE_TITLE, "UTF-8"); will help.
 
Yes, thanks, it is better !!!

But not perfect :rolleyes: ...

Indeed, "???-?aa" gives "???-?aa", nice ! Thank you for that, it was not possible without the "UTF-8" argument.

But "V??ga" no changes, and gives "V??ga"...
 
Thanks

It is again better, but always not perfect...

Indeed, "V??g?" give "V??g?".

But no problem, it is already very nice !
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top