betulb
25 February 2019 08:37
1
Hi everbody,
I need some help. I want to create auto phone number formatting.
I entering this format at first --> 902161111111
Then I want it to be converted to this format after saving–> +90(216) 111 1111
I try logichooks. But I failed.Please help me.
Thank you.
Hi,
You can use login hook. This is the best option. You should use BEFORE_SAVE logic hook.
How did you used the hooks??
Other Option can be to use JavaScript at front end, and run in ON BLUR event of the field.
For both of the things, you will need coding skills.
Thanks
betulb
25 February 2019 10:41
3
Hi Elite,
I used before_save but they didn’t work. Or I couldn’t.
Firstly custom\modules\Accounts\logic_hooks.php --> $hook_array[‘before_save’][] = Array(1, ‘tutorialNumber’, ‘custom/modules/Accounts/tutorial_number.php’, ‘tutorial_number’, ‘number’);
Then I added custom\modules\Accounts\tutorial_number.php and I filled in these codes ;
class tutorial_number
{
function number ($bean, $event, $arguments)
{
$bean = '092163688776';
$event = '/([0-9]{12})';
$arguments = '/([\+]90?)([ ]?)(\([0-9]{3}\))([ ]?)([0-9]{3})(\s*[\-]?)([0-9]{2})(\s*[\-]?)([0-9]{2})';
echo preg_replace($event, $arguments, $bean);
}
}
I’m sure some parts are wrong. Maybe you can help me coding things.
Thanks.
Hi,
Many things are wrong here.
Code is not valid and also Logic Hook definition is also not valid.
Can you Skype please? This will save the time.
betulb
25 February 2019 11:05
6
Hi,
Is there a platform to communicate with? I do not use Skype.
I need this code also. Do you share it with me?
Thanks.
I also need something like this…can you explain what is wrong with the code above?
Thanks!
hi,
the code should assign the value to $bean instead it is displaying the values
We can create an entry point and make an Ajax call to the entry point on the event of onchange or onblur and set the control value with response received from the entry point in javascript code.
Entry points are simply a page which provides access to SuiteCRM. These can be used for a variety of purposes such as allowing an external form simple access to SuiteCRM or, as is the case with the stock Events module, allowing an event invite to be...
rsp
29 August 2024 13:48
12
Could you please provide step-by-step guidance on it?