We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

custom characters in join Questions! | Forum

Hadi Kamell
Hadi Kamell Jan 31 '13
Hi

i want that the REAL_NAME question of my site be fielded only by UTF-8 characters by my site's users at joining..

( Like USERNAME question that in default of oxwall most fielded only  by Latin characters in join time.. )

Please help me that where i should change in database??


(Example: هادی is true and Hadi should be ignored for name, because is not a Persian UTF-8 word! )


Alia Team
Alia Feb 1 '13
Hadi,  this is custom code modification. You need to edit user_question_form.php ( ow_system_plugins/base/classes).

right after:

     // set field value

            if ( isset($questionData[$question['name']]) && $question['presentation'] !== BOL_QuestionService::QUESTION_PRESENTATION_PASSWORD )
            {
                $this->setFieldValue($formField, $question['presentation'], $questionData[$question['name']]);
            }

            $this->addFieldValidator($formField, $question);

            $formField->setRequired((string) $question['required'] === '1');



paste the following code:

   if (  $question['name'] == 'realname')
            {
                $formField->addValidator(new RegExpValidator('/^[\w]+$/'));
            }


Since this is custom code modifications you are doing it at your own risk. All changes made within the code will be erased if you update the software.
Hadi Kamell
Hadi Kamell Feb 2 '13

Hi dear Aliia,

thanks for your help,

but how can i add Persian characters only in RegEXp ??

or, please guide that how can i add SPACE character to it ?

(because i was added all Persian Alphabet to RegExp , but space is not adding, what is its code? )

BEST REGARDS

Mike
Mike Feb 2 '13
I need that too! (Spaces won't work)
Mike
Mike Feb 4 '13
*Bump*


My problem is.


i DONT wanna show users there real name on the profile.

i WANNA show users there username on the profile.


With the code above... it does what i asked.... the problem now is:


People CANT add spaces at the Real name (and last name) field in the registration.

People CAN add spaces in there username....


I wanna change chat. No spaces in the username, spaces in the real+ last name.


Another thing is.


People still CAN see there real+last name on there profile with BIG orange letters.


That has to be changed to there USERNAME in big orange letters.


What i want = I can edit the questions username to be real name and real name to be username. Everything is cool than. But THEN the problem is... On there profile is showing there REAL NAME. everywhere. and i don't want that. Only the username should be Aviable everywhere.

Hadi Kamell
Hadi Kamell Feb 4 '13
Quote from Aliia Hadi,  this is custom code modification. You need to edit user_question_form.php ( ow_system_plugins/base/classes).

right after:

     // set field value

            if ( isset($questionData[$question['name']]) && $question['presentation'] !== BOL_QuestionService::QUESTION_PRESENTATION_PASSWORD )
            {
                $this->setFieldValue($formField, $question['presentation'], $questionData[$question['name']]);
            }

            $this->addFieldValidator($formField, $question);

            $formField->setRequired((string) $question['required'] === '1');



paste the following code:

   if (  $question['name'] == 'realname')
            {
                $formField->addValidator(new RegExpValidator('/^[\w]+$/'));
            }


Since this is custom code modifications you are doing it at your own risk. All changes made within the code will be erased if you update the software.

please help us for SPACE cheracter, dear Aliia
Michael I.
Michael I. Feb 4 '13
Try using the following RegExp: 


/^.+$/

Mike
Mike Feb 5 '13
Quote from Michael I. /^.+$/

Doesn't work! :(


And can you answer my question above?

Mike
Mike Feb 6 '13
Bump
Hadi Kamell
Hadi Kamell Feb 10 '13

Hi


If you want to allow a pure whitespace text you can use
[\s\S]+

\s a whitespace character

\S a non whitespace character

that would match at least one character and would also match newlines, because they are included in \s

If you want to have at least one Non-whitespace character you can use
^\s*\S

That would check for 0 or more whitespaces at the start of the string (this would cover leading newlines) and it would be successful when it finds the first non whitespace.


REFERENCE: http://stackoverflow.com/questions/13085572/vaadin-regexpvalidator-regex

The Forum post is edited by Hadi Kamell Feb 10 '13