Skip to content

Commit 8e36bf1

Browse files
committed
Fix issue with manual lat/lng and not copying across the values or readonly state
1 parent b167f88 commit 8e36bf1

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/AddressFinderField.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,27 @@ public function FieldHolder($properties = array())
201201

202202
$fields = $this->getManualFields();
203203

204-
if($this->showLatLngManual) {
204+
if ($this->showLatLngManual) {
205205
$name = $this->getName();
206206

207-
$fields->removeByName("{$name}[Longitude]");
207+
$longitude = $fields->dataFieldByName("{$name}[Longitude]")->Value();
208+
209+
$latitude = $fields->dataFieldByName("{$name}[Latitude]")->Value();
210+
208211
$fields->removeByName("{$name}[Latitude]");
212+
$fields->removeByName("{$name}[Longitude]");
213+
214+
$replaceLong = new TextField("{$name}[Longitude]", 'Longitude', $longitude);
215+
216+
$replaceLat = new TextField("{$name}[Latitude]", 'Latitude', $latitude);
217+
218+
if ($this->isReadonly()) {
219+
$replaceLong->setReadonly(true);
220+
$replaceLat->setReadonly(true);
221+
}
209222

210-
$fields->push(new TextField("{$name}[Longitude]", 'Longitude'));
211-
$fields->push(new TextField("{$name}[Latitude]", 'Latitude'));
223+
$fields->push($replaceLong);
224+
$fields->push($replaceLat);
212225
}
213226

214227
$properties = array(

0 commit comments

Comments
 (0)