Input Conditions

Hello,

I want to submit my input field to certain condition:

  • Value has to be > 0, maximum 2 decimals and has to be a currency.

  • Description has to be defined as text and can only consists of 30 characters.

Is it possible to define a new ‘format’ (same as integer, currency is defined now) for which these conditions applies (eg. value and description) and define this as a result and afterwards define input fields in different templates as below?

{% input custom.investment.value as:value %}

Kind regards,

Marnix

Hi Marnix,

You cannot really define such format yourself, but you could do one of the following:

  1. trigger some kind of error when the value is smaller than 0, by checking the value, for example:
{% input custom.some.thing as:currency %} {% if custom.some.thing < 0 %}put error message here{% endif %}
  1. in a similar way you could have the description as a field that you can type whatever you want, but in the export you only show the first 30 characters, for example:
{% ic %}{% input custom.some.thing %}{% endic %}{% nic %}{{ custom.some.thing | truncate: 10, "" }} {% endnic %}

We are investigation to add certain options to the input (for example, precision, I’ll add ‘length’ to the list to consider).

Can you specify the exact scenario you need this for? Maybe I can come with a better solution?

Hi Tim,

Thanks for the swift reply.

We need this because certain input fields in biztax can only contain positive values. In addition they can only have 2 decimals but I understood from Timothy that if you export the tax return the values defined as currency are rounded at 2 decimals.

For text inputs biztax accepts only 30 characters that’s why I wanted to limit the input fields but your solution will work as well. In addition biztax does not accept ‘exotic characters’ (eg. à, ç, &, é ,@,…). Do you have any solution to prohibit the input of these characters or to limit the export?

Thanks a lot,

Marnix

We currently don’t have something to prevent exotic characters either. I’ll note it down though on that same list of possible restrictions.