I would like to make the “telephone” field “required” in the contact form on this page Installatori Suntek » suntekItalia
how can I do ?
Thank You
I would like to make the “telephone” field “required” in the contact form on this page Installatori Suntek » suntekItalia
how can I do ?
Thank You
Welcome to the forum!
Could you post the code which is generating your form? (Presumably it’s in the controller)
You might just need to include it in the required fields (Introduction to Forms – SilverStripe Documentation)
but it’s a bit hard to know for sure without seeing some code.
hi, could be this?
<% if $Message %>
$Message
<% else %> <% end_if %>
Cerca per provincia
$Fields.dataFieldByName(Provincia) $Fields.dataFieldByName(Nome) $Fields.dataFieldByName(Cognome) $Fields.dataFieldByName(Cellulare) $Fields.dataFieldByName(Email) $Fields.dataFieldByName(Pagina)
$Fields.dataFieldByName(Privacy) $Fields.dataFieldByName(Privacy).Title
$Fields.dataFieldByName(SecurityID) $Fields.dataFieldByName(Telephone) <% if $Actions %>
<% loop $Actions %>$Field<% end_loop %>
<% end_if %>
No it is not. It should be a php method public function YourForm()
Try to understand Introduction to Forms – SilverStripe Documentation
in your form methode you can do something like $required = new RequiredFields('telephone');
and pass it to your form constructor.
It should be in mysite i guess it will be one of your PageControllers. It depends on how you did it. I‘d go to the template where the form is rendert and look for the name of the Form variable $YourForm(what ever the form name is)and than search for the name of the form without the $ in your ide in the mysite folder. You should find a methode with that name.
Do you still need help? Just in case: add ‘telephone’ to the array.
thank you Greg for you support,
have a nice day