October: Twig function for `Form::number('name', 'value')` does not exist

Created on 19 Oct 2020  路  1Comment  路  Source: octobercms/october

  • OctoberCMS Build: 469

Description:

The https://octobercms.com/docs/services/html states that

in Twig all functions prefixed with form_ will bind directly to the Form facade and provide access to the methods using snake_case

However, {{ form_number('name', 'value') }} for Form::number('name', 'value') facade method throws the following error:

An exception has been thrown during the rendering of a template ("Method number does not exist.").

Question

Most helpful comment

@zigi05 The Form facade is linked to the October\Rain\Html\FormBuilder class, which does not have a number method. You could instead use form_input and use number as the first attribute (ie. {{ form_input('number', 'fieldName', 'fieldValue') }})

>All comments

@zigi05 The Form facade is linked to the October\Rain\Html\FormBuilder class, which does not have a number method. You could instead use form_input and use number as the first attribute (ie. {{ form_input('number', 'fieldName', 'fieldValue') }})

Was this page helpful?
0 / 5 - 0 ratings