• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFINPUT mask

Contributor ,
Aug 11, 2022 Aug 11, 2022

Copy link to clipboard

Copied

Bonjour,

J'ai bien compris le fonctionnement quand on connait le nombre déléments :

<CFINPUT type="text" name="Iban1" mask="??00" size="4" maxlength="4">

Par contre, je n'ai pas compris quand on connait pas la longeur à l'avance :

Exemple : 0.50 ou 2.25 ou 65.85 ou 357 ou 1 253.35.

D'autre existe-t-il un moyen pour empécher de saisir dans un champ suite à une condition non remplie.

Merci d'avance pour votre aide.

 

Hello,

I understand how it works when you know the number of elements:

<CFINPUT type="text" name="Iban1" mask="??00" size="4" maxlength="4">

On the other hand, I did not understand when we do not know the length in advance:

Example: 0.50 or 2.25 or 65.85 or 357 or 1,253.35.

Else is there a way to prevent typing in a field following an unfulfilled condition.

thank you in advance for your help.

 

 

TOPICS
Documentation , Getting started

Views

195

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 13, 2022 Aug 13, 2022

Copy link to clipboard

Copied

Hello ! 

Personne n'a d'idées ? 

Merci par avance.

 

Hello !

Nobody has any ideas?

Thanks in advance.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 13, 2022 Aug 13, 2022

Copy link to clipboard

Copied

Well,  when you say "prevent", that implies validation--which you're not doing. As far as I know,  the mask just controls display of values as people type. That said,  you show using maxlength,  and that WOULD prevent the browser from letting you type more than 4 characters.

 

Maybe try rewording one more time. 🙂 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 19, 2022 Aug 19, 2022

Copy link to clipboard

Copied

Hello ! 

Personne n'a d'idées ? 

Merci par avance.

 

Hello !

Nobody has any ideas?

Thanks in advance.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2022 Aug 20, 2022

Copy link to clipboard

Copied

@ZNB , could you please first let us know your reaction to Charlie's comment?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 20, 2022 Aug 20, 2022

Copy link to clipboard

Copied

Bonjour,
La reflexion " Essayez peut-être de reformuler une fois de plus. 🙂" n'est pas gentille et surtout ... n'apporte rien.
D'autre part, je n'ai pas de réponse à mes 2 questions que je reformule :
1 - mask quand on connait pas la longeur à l'avance ( Exemple : 0.50 ou 2.25 ou 65.85 ou 357 ou 1 253.35.)
2 - est-il possible d'empécher une saisie quand une condition n'est pas remplie (peut-etre en javascript).
Merci de l'aide

 

Hello,

The reflection "Maybe try to rephrase one more time. :smiling_face_slightly:" is not nice and above all ... does not add anything. On the other hand, I have no answer to my 2 questions that I rephrase:

  1.  mask when we don't know the length in advance (Example: 0.50 or 2.25 or 65.85 or 357 or 1 253.35.)
  2.  is it possible to prevent an input when a condition is not met (maybe in javascript).

Thanks for the help

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 21, 2022 Aug 21, 2022

Copy link to clipboard

Copied

If you don't know the length in advance, a mask will then be irrelevant. At least, that is what I think.

 

You mentioned Javascript. I would recommend using it to validate the input. 

 

Let's assume you wish to validate IBAN bank-accounts. The following Javascript provides a simple example to start with.

<cfif isDefined("form.fieldnames")>
	<cfdump var="#form#" >
</cfif>

<cfform name="myForm" action="#CGI.SCRIPT_NAME#" onsubmit="return validateIbanForm()" method="post">
IBAN1: <cfinput type="text" name="Iban1" size="27" maxlength="27">
<cfinput type="submit" value="Submit" name="sbmt">
</cfform>

<script type="text/javascript">
function validateIbanForm() {
 	var iban = document.forms["myForm"]["Iban1"].value.trim();
  	if (iban == "") {
    	alert("The field may not be blank. You must enter your IBAN");
    	return false;
  	}
  	/* In France, for example, an IBAN has 27 characters. */
  	if (iban.length != 27) {
    	alert("You must enter a valid IBAN");
    	return false;
  	}
  	return true
}
</script>


 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 01, 2022 Sep 01, 2022

Copy link to clipboard

Copied

Bonjour,

Je voudrais, si cela est possible que les sommes s'affichent :

1253.23 en 1 253.23!

mais je peux aussi avoir une somme plus importante ou moins importante :

125234.56 en 125 234.56  ou 0.23 en 0.23.

Merci par avance.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 03, 2022 Sep 03, 2022

Copy link to clipboard

Copied

HELP

Pas de réponse ?

Merci par avance

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 03, 2022 Sep 03, 2022

Copy link to clipboard

Copied

I think the best solution is as follows. Search the web for Javascript that will convert a number into your local format as soon as the user types it in the input field.  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Sep 06, 2022 Sep 06, 2022

Copy link to clipboard

Copied

LATEST

Bonjour,

Cela s'attesfait pas mais ...

Merci encore

NB : je ne comprends pas que CF ne donne pas la possibilité d'afficher un nombre au moment de la saisie !

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation