Skip to content
Advertisement

Slim framework 4; return Formr-form

In Slim framework 4; How can I return a Formr-form in my controller as a response to a get-request?

JavaScript

The code outputs nothing. However, if I uncomment the two lines, it outputs (as expected):

JavaScript

Advertisement

Answer

From Formr documentations:

Formr will automatically echo form elements and messages to the screen, and this is usually fine. However, in some instances – such as when using a templating framework – this is not an option. In these cases simply pass the word hush and then manually echo your elements and messages.

$form = new FormrFormr('bootstrap', 'hush');

The default value for the first parameter of FormrFormr constructor is an empty string, so in your case you should create new Formr instance with an empty string '' as the first parameter ann 'hush' as the second parameter:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement