[Formit] Is there a way to have a start on requiered field

Dear All,

I finally could configured a form with formit.
I have a couple a required fields and the owner of the web site, wish to have red stars at the right of the fields.

I do not want to add “manually” the stars, but I am sure there is a way to automatically add a start to the fields mention as required.

Could you give me an recommendation to get it’

Many thanks

You should be able to achieve this just by using CSS. As long as the fields have the required attribute, you can address them using the CSS pseudo class selector :required and add your star using ::after or similar methods.

1 Like

Hello
That a good idea, but formit does not add the reuqied in the filed

		<label for="name">
			Prénom et nom
			<span class="error">[[!+fi.error.name]]</span>
		</label><br>
  		<input type="text" id="name" name="name" value="[[!+fi.name]]"><br>

The second problem, the star need to be after the label and not after the field

Formit has nothing to do with your html, you can simply add that yourself. If the star should be after the label tag, maybe give those a class like class="required" and then address that class in your CSS.

(Note that the validation in Formit within the &validate property is also serverside and independent from the html required attribute. So if a field has the required attribute, that just tells the browser to check if the field is filled, which can be bypassed, therefore the &validate property is the more secure way.)