Joomla 5 Notice

We are pleased to announce that as of January 29, 2024, all of our Joomla extensions are compatible with Joomla 5.

For all who are still updateing from Joomla 3 to Joomla 4: Joomla 4 Migration instructions are available here:

There is now a separate Documentation for Visforms for Joomla 4 and for Visforms for Joomla 5!

Forum

Visforms Subscription user can ask questions in our forum. Please log in with the relevant user first.
Everybody can access the forum for reading.

Please only ask 1 question per topic.

Important information for almost every question:
V1: Which Visforms version is running?
V2: Which Joomla version is running?
V3: Which PHP version is running?

issue with numeric field

More
9 years 4 weeks ago #2150 by meysam66
issue with numeric field was created by meysam66
hello
first of all thanks for your awesome extension. its very rare to find an extension with such functionality.

i had a problem with number field, i wanted a field to get my client telephone or mobile number, so my choice was "number" for the field type also it was better that user couldn't type alphabetic text in that field.

but when i lunched to my form, i saw an increment up and down button left side of the input field, it was unwanted to me so i tried to captured the css class related to that to set it's display to none through firebug but i found nothing.
then i tried to test changing the field type by firebug, i found a field type called "tel" that was my desired one, so i came back to change the field type but i realized there is no such field type at visform field list.

phone type or just a numeric simple field is very common, i am confused

do you have any suggestion to help me make it right?

More
9 years 4 weeks ago #2152 by Administrator AV
Replied by Administrator AV on topic issue with numeric field
Hi,

the number field type is really meant to take numbers (integers or decimals). Numbers cannot have a leading zero and therefore are never suited to take a phone number. Providing functionality to increment the number is a browser implementation and not a Visforms implementation. As far as i know, it is not possible to change this with css (It the same with the design of upload field for example).

You are correct, that the amount of different field types supported by html5 is increasing constantly and the browser support for those field types becomes more and more common. This was different in the past and that is, why those modern field types are not yet available in Visforms. But even if there were a field type "tel" I would not know which validation rules I have to implement because phone number format is very different throughout the world. Nevertheless I will set your request to my feature wish list and check this point again. But this may take its time.

Having said this, Visforms provides a solution for your problem. There is an option to add a custom validation to the field type "text".
If you want to make sure, that only numbers are typed in use the following regular expression with this option.
Code:
^\d*$
If you want to make sure, that the user can only input a given amount of numbers (12 in this example) use the following regular expression with this option. Adapt the number in the curly brackets to the amount of characters of a phone number in your country.
Code:
^\d{12}$

You can allow a range for the amount of numbers required, too. For example if the length of a phone number can vary between ten and twelve use the following regular expression.
Code:
^\d{10,12}$

Or you can search on Google for a regular expression suited for the phone number format in your country.

Good luck,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
The following user(s) said Thank You: meysam66

More
9 years 4 weeks ago #2156 by meysam66
Replied by meysam66 on topic issue with numeric field
thank you "administrator" for your solution, i have used it, i think it's ok for now.

and you are right about differences of telephone number formats in various location,
i have seen a kind of field type with the name "phone" in other form or contact extensions which was a simple input field and accepting only numbers 0 to 9 with no specific length limit.

and i saw another field type in one form, which was taking only numbers (0 to 9) and dash (-) character for separating any area codes.

thanks again for your reply.

More
9 years 4 weeks ago - 9 years 4 weeks ago #2157 by Administrator AV
Replied by Administrator AV on topic issue with numeric field
Hi,

you're welcome.

Thanks for the additional information. So actually, you can achieve all this with Visforms "out of the box" and actually you are even more flexible, because you can decide yourself which custom validation you want to apply. (And now it is documentated so that everybody who searches the forum can find the solution :) )

Please don't forget to add a custom error message to the field (in field configuration) in order to let your users know which format you require (if validation fails).

Regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
Last edit: 9 years 4 weeks ago by Administrator AV.
The following user(s) said Thank You: meysam66

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum