• Resolved giuseppe65

    (@anguria65)


    Hi,
    i noticed that html fields are not listed in the “Calculated field“.
    If there is a numeric input type in an html field, can it be included in a calculation?
    Thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @anguria65

    No, sorry, that is not possible. Input tags that you insert directly into “HTML Content” fields are not plugin controls, and you cannot access them from equations, like you do with other form fields. If you need an input tag to enter numbers, you must insert a “Number Field”.

    Best regards.

    Thread Starter giuseppe65

    (@anguria65)

    Hello @codepeople,
    thanks for the reply.
    Reading your previous answer I understood that, for example, a text field with time format could be generated and I thought it could be done using an html field.
    Is there a way to generate a text field with time or number format?
    Congratulations, the plugin is great!

    Thanks

    • This reply was modified 2 years, 5 months ago by giuseppe65.
    Plugin Author codepeople

    (@codepeople)

    Hello @anguria65

    You can insert a “Single Line Text” field in the form and enter a regular expression through its settings to ensure the user types a value with format hh:ii, like:

    /^\d{1,2}:\d{1,2}$/

    You can enter the error message through its “Error message when the regular expression fails” attribute.

    Best regards.

    Plugin Author codepeople

    (@codepeople)

    Hello @anguria65

    Another alternative would be to insert a date/time field in the form, enabling the time component and disabling the date one (these are checkboxes in the field’s settings.)

    Best regards.

    Thread Starter giuseppe65

    (@anguria65)

    Hello @codepeople,
    thanks for the reply.
    I entered the date/time field in the form, enabling the time component and disabling the date one, however the times are proposed with a drop-down list and not with the clock as the html time input. On mobile it would be more comfortable.

    Best regards.

    Plugin Author codepeople

    (@codepeople)

    Hello @anguria65

    If you prefer using input tags instead of lists, you can insert a “Single Line Text” control as I described previously.

    Best regards.

    Thread Starter giuseppe65

    (@anguria65)

    Hello @codepeople,
    i prefer to use html input type and calculate using javascript.

    Best regards.

    Plugin Author codepeople

    (@codepeople)

    Hello @anguria65

    In this case, you have another alternative. If you have an input tag in an “HTML Content” field, for example, with id="my-field", you can access its value form the equation as follows:

    jQuery('#my-field').val()

    And if you want to evaluate the form equations each time the field varies its value, you can include the following piece of code in the “HTML Content” field.

    <script>
    jQuery(document).on('change', '#my-field', function(){EVALEQUATIONS(this.form);});
    </script>

    Best regards.

    Thread Starter giuseppe65

    (@anguria65)

    Hello @codepeople,
    Thanks.

    Best regards.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Calculation of html content’ is closed to new replies.