Open florinutz opened 10 years ago
->add('map_coordinates', 'oh_google_maps', array(
'required' => false,
'map_width' => '90%',
'default_lat' => 45,
'default_lng' => 25,
'lat_name' => 'Latitude',
'lng_name' => 'Longitude'
))
this won't work either
nor does 'options' => array('required' => false)
Hi @florinutz Are you getting an error message?
I am getting this error message too, but fields are not empty. I am using the map in a Sonata Admin form.
Is there any new/solution about required false? The error message is The values for latitude and longitude ("0" and "0") are not valid when empty.
Hi, this is my LocationsAdmin.php config
->add('latLng', 'oh_google_maps', array(
'lat_options' => array(
'label' => 'Latitud',
'required' => false
), // the options for just the lat field
'lng_options' => array(
'label' => 'Longitud',
'required' => false
), // the options for just the lng field
'default_lat' => 40.415363, // the starting position on the map
'default_lng' => -3.707398, // the starting position on the map,
'required' => false
))
The fields are not required in the form.
When you try to save, with lat and lng fields empty, LatLngValidator addViolation, with this error "The values for latitude and longitude ("0" and "0") are not valid."
If you try to save with 0 in lat and lng fields, works like a charm.
any idea to solve it?
thanks
Hi again,
this "solution" works ok,
->add('latLng', 'oh_google_maps', array(
'lat_options' => array(
'label' => 'Latitud',
'required' => false,
'data' => 0
), // the options for just the lat field
'lng_options' => array(
'label' => 'Longitud',
'required' => false,
'data' => 0
), // the options for just the lng field
'default_lat' => 40.415363, // the starting position on the map
'default_lng' => -3.707398, // the starting position on the map,
'required' => false
))
any comments to improve it?
->add('map_coordinates', 'oh_google_maps', array( 'required' => false, 'lat_name' => 'Latitude', 'lng_name' => 'Longitude' ))
How can I make these REALLY not required?