Kentico 9 form fields.. Is there a way to make a feild into a currency field only? - forms

Have a form I am trying to build and even though I have a text box field that will work for users to enter a $ amount it would be nice to make it so that field only accepts numbers and keeps it in the $0.00 format. Seems like a simple thing but I cannot seem to find out how this would be done.

You need to specify the field as a decimal or double and define the precision (depending on what version you are using). The field should NOT be a text field but can use a textbox as the displaying control.
From an output standpoint, it will not automatically output $0.00, you have to format that based on the culture. There are several macros and functions within the API to do this.

Setup you control as followed
make the Data type a decimal number
in the Editing control settings click to show the Advanced section
in Filter set Type to Numbers and Custom
Add Valid characters your delimiter (, or .)
In the validation section add a rule for the minimum value to be 0.
The data type will enforce it to be a actual number.
You could also use as Validation a Regular expression setting something like:
^[$]?([0-9]{1,2})?,?([0-9]{3})?,?([0-9]{3})?(\.[0-9]{2})?[$]?$
which will allow a dollar sign prefix or suffix.

Related

Restricting giving numbers or special symbols as form name

I need help in restricting entering form names as numbers in forms flow.
when I am checking I can see that I can enter numbers/special symbols as form name. So I thought it is meaningless if I can enter like that. how can I restrict giving numbers/symbols to form name? can I do it in the form design itself?

Nesting Math Functions in Javascript

I am working on an Acrobat form that should only accept positive, whole numbers in a field.
It is ideal if the number is simply reformated to suit the criteria. For example, if a user types in "-1.4", it should simply change to "1".
Is it acceptable to use this as the "Validation Script" for the field:
if (event.value) event.value = Math.abs(Math.round(event.value));
It seems to work, but is it ok to nest functions like this in general, or will it lead to issues.
Rather than change the value during the validation event, prevent an invalid value from being entered in the first place. To allow only numbers with no dashes to be entered, add the following to the custom keystroke event.
event.rc = !(/[a-zA-Z\-]/.test(event.change));
You may want to modify the regex to prevent other characters as well. I just did the bare minimum. Remember that you'll need to allow for the delete key, return key, and backspace to be permitted so you can't just limit the regex to 0-9 (which would be the obvious thing to do).

How to display and read a float in a non english (german) ionic 3 app?

In an ionic 3 app I am currently trying to get a floating point number as user input. Since the application is exclusively targeting a german audience I am expecting input with a comma as the decimal separator, e.g. 750,5.
In addition I would like to open the numerical keyboard.
I tried including an input field with type="text". I parsed the resulting input string using a custom parsing method, which respects the different decimal separator.
Since the input field has a two way binding and the application might change the number itself I convert the number to a string using the Angular decimal pipe like so:
numberString = new DecimalPipe('de').transform(value.count, '1.0-2');
That worked well, however the app always opens the full alphanumerical keyboard.
To show the numerical keyboard I used the input field with type="number".
<ion-input type="number" step="any"></ion-input>
Using this, the numerical shows as expected. However the input field now includes thousand separators. For example if I type 7500, the input field displays 7,500 using the English decimal separator.
Now I am not sure where this problem is caused but the app itself seems to be running under an English locale although the device is set to German. I expect the problem to be solved by setting the web view locale to German. How could I achieve this?

Docvariable with empty string value

In word, I'm using docvariables to manage pluralization.
A VBA macro is changing the value of several docvariables to pluralize / singularize them.
But sometimes I want to use a Docvariable only for enable/disable a 's' suffix.
Problem: I cannot set it to empty string, because it deletes the docvariable.
The field displays an error in word.
So I'm searching a way to achieve this, it could be :
A way to keep a Docvariable existing, with empty string or equivalent value
A field formula which make this job if the variable doesn't exist
Any other workaround would be appreciated.
Thank you
A Document Variable (used in DocVariable field codes) cannot exist if it has no content.
A possibility would be to also store the space in this DocVariable so that it display s[space] or just [space].
Otherwise you may need to write this information to a Bookmark (possibly using a Set field) and display the content using a Ref field.

Apply a mask to GWT TextInputCell

I have overridden GWT TextInputCell.onBrowserEvent() to restrict input length and content.
I want to apply an input mask to format the input as the user types:
Enter 1234567890 and it is transformed to 123-456-7890 (telephone number).
I'd like to maintain the format during editing, such that a partial value is allowed
and dashes will be preserved in the partial value as well.
It would be nicer still to display the mask at all times, with blank space placeholders.
How do I determine, for each keystroke, where the cursor is within the input value?
In other words, I want to get the index of the value that's about to be added, deleted, etc.
Thanks in advance, any advice, examples appreciated.