Ejs input_field_tag method setting type attribute as 5

217 Views Asked by At

I am using ejs for template rendering, I am using below code

<%- input_field_tag('empName', 5) %>

Which generates output as

<input id="empName" value="" type="5" name="empName">

Here the type attribute is set as 5 -- Which actually need to be set as text and value attribute need to be set as 5

I am referring code from ejs_wiki_ViewHelpers, Where they stating that output will be generated as <input id='empName' value='5' type='text' name='empName'/>

Let me know what is going wrong in my code, because I have simply copy pasted it from the docs.

1

There are 1 best solutions below

5
On BEST ANSWER

You are probably using express-helpers module which uses different arguments than plain ejs view helpers.

The input_field_tag in express-helpers module takes name as the first argument, inputType as the second one and third is options object.

See wiki of this module for more information.