2013-03-29 14 views
8

haml może sprawićCzy haml renderowanie <input type = "text" wymagane>

%input{:type=>"text"} 

jak

<input type="text"> 

Ciekawe, co powinno być w haml więc jest renderowane w html jak

<input type="text" required> 

Dzięki

+1

naprawdę nie, czy jest to prawidłowy sposób, ale zawsze 'wymagane: true 'dla tego rodzaju atrybutów – pjam

Odpowiedz

13

Jeżeli np

%input{:type=>"text", :required => true} 

będzie wyświetlany jako obu

<input required type='text'> 

jeśli format option jest :html4 lub :html5 lub jako

<input required='required' type='text' /> 

gdy format :xhtml.

Jeśli wartość jest fałszywa, to zostanie całkowicie pominięte:

<input type='text' /> 
1
%input{:required => "", :type => "text"}/