Lose google map coordinates on back button
I write the address, press enter, a marker appears with the coordinates. I follow the instructions, go to the next page, the url parameters are transmitted with coordinates values.
If I press the button back, the hidden inputs in which must be coordinates, lose the necessary values, but the address remains the same. If I follow the instructions again, on the next page the coordinates are no longer transmitted to the URL, and at the end everything breaks down.
I dont wont to lose value of the coordinates before back button click.
It posible?
(/join - first page),
(/new - second page)
***/join.html.twig***
<div class="form-group col-md-1 add-address-wrapper">
<div class="move-from-above"> </div>
<button type="button" class="btn btn-default btn-sm btn-set-location" aria-label="Set location"
data-toggle="modal"
data-target="#filterLocationModal"
data-address-field="#{{form.address.vars.id}}"
data-latitude-field="#{{form.latitude.vars.id}}"
data-longitude-field="#{{form.longitude.vars.id}}">
<img src="{{ asset('Resources/public/images/icons/map-point.png') }}" alt="">
</button>
</div>
<div class="form-group col-md-4 padding-left-none padding-right-none coordinates">
<label>
{% trans %}Destination address{% endtrans %}
</label>
{{form_widget(form.latitude)}}
{{form_widget(form.longitude)}}
{{form_widget(form.address, {'attr': {'readonly': 'readonly', 'class': 'form-control'}})}}
{{form_errors(form.address)}}
</div>
***/TripRequestController.php***
/**
* Creates a new tripRequest entity.
*
* @Route("/new", name="request_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
if (!$this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) {
throw $this->createAccessDeniedException();
}
$tripRequest = $this->container->get('autotracker.trip_request')->getNewRequestStub($this->getUser());
if ($filterDate = $request->query->get('trip_date')) {
$tripRequest->setTripDate(new DateTime($filterDate, new DateTimeZone('UTC')));
}
if ($filterAddress = $request->query->get('dest_addr')) {
$tripRequest->getDestinationWaypoints()[0]->setAddress($filterAddress);
}
if ($filterLatitude = $request->query->get('dest_lat')) {
$tripRequest->getDestinationWaypoints()[0]->setLatitude($filterLatitude);
}
if ($filterLongitude = $request->query->get('dest_long')) {
$tripRequest->getDestinationWaypoints()[0]->setLongitude($filterLongitude);
}
$form = $this->createForm(
'AutotrackerRequestBundleFormTripRequestType',
$tripRequest,
['view_timezone' => $this->getUser()->getTimezone()]
);
$form->add('create', SubmitType::class, [
'label' => 'Create request',
])
->add('create_and_search', SubmitType::class, [
'label' => 'Create and initiate search',
]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($tripRequest);
$em->flush();
if ($form->get('create_and_search')->isClicked()) {
return $this->redirectToRoute('request_edit', [
'id' => $tripRequest->getId(),
'_fragment' => 'driversearch',
]);
} else {
return $this->redirectToRoute('request_index');
}
}
$mapService = $this->container->get('autotracker.service.geo');
return $this->render('AutotrackerRequestBundle:TripRequest:new.html.twig', array(
'tripRequest' => $tripRequest,
'form' => $form->createView(),
'tz' => $this->getUser()->getDateTimeZone(),
'map' => $mapService->getGoogleMap($tripRequest->getClientAgency()),
'geocoderUrl' => $mapService->getGoogleGeocoderUrl(),
));
}
/**
* Join existing trip page.
*
* @Route("/join", name="request_join")
* @Method({"GET", "POST"})
*/
public function joinAction(Request $request)
{
$user = $this->getUser();
$tz = $user->getDateTimeZone();
$agency = $user->getAgency();
$em = $this->getDoctrine()->getManager();
$formBuilder = $this->createFormBuilder();
$formBuilder
->add('address', TextType::class, [
'constraints' => [
new NotBlank(),
]
])
->add('latitude', HiddenType::class)
->add('longitude', HiddenType::class)
->add('address_autocomplete', PlaceAutocompleteType::class, [
'mapped' => false,
'api' => false,
'variable' => 'autocomplete_address_popup',
'components' => [AutocompleteComponentType::COUNTRY => 'md'],
'types' => [AutocompleteType::GEOCODE],
])
->add('favorites', EntityType::class, [
'mapped' => false,
'required' => false,
'placeholder' => 'Choose address',
'class' => 'AutotrackerUserBundle:FavoriteAddress',
'choices' => $agency->getFavoriteAddresses(),
'choice_label' => 'address',
])
->add('date', DateType::class, [
'label' => 'Date',
'widget' => 'single_text',
'input' => 'datetime',
'html5' => false,
'format' => 'dd.MM.yyyy',
])
->add('filter', SubmitType::class, [
'label' => 'Show requests',
])
->add('create', SubmitType::class, [
'label' => 'Create new request',
]);
$form = $formBuilder->getForm();
$form->handleRequest($request);
$tripList = ;
if ($form->isSubmitted() && $form->isValid()) {
$filterDate = $form->get('date')->getData()->setTime(0, 0);
$filterAddress = $form->get('address')->getData();
$filterLatitude = $form->get('latitude')->getData();
$filterLongitude = $form->get('longitude')->getData();
if ($form->get('filter')->isClicked()) {
$tripList = $em->getRepository('AutotrackerRequestBundle:TripRequest')
->findJoinable(
$filterDate,
$filterAddress
);
} elseif ($form->get('create')->isClicked()) {
return $this->redirectToRoute('request_new', [
'trip_date' => $filterDate->format('Y-m-d'),
'dest_addr' => $filterAddress,
'dest_lat' => $filterLatitude,
'dest_long' => $filterLongitude,
]);
}
}
$mapService = $this->container->get('autotracker.service.geo');
return $this->render('triprequest/join.html.twig', [
'form' => $form->createView(),
'tz' => $tz,
'tripList' => $tripList,
'map' => $mapService->getGoogleMap($user->getAgency()),
'geocoderUrl' => $mapService->getGoogleGeocoderUrl(),
]);
}
Screenshots: https://prnt.sc/m2hvly
Coordinates in hiden input after click "Select adress" - https://pp.userapi.com/c847219/v847219764/16748d/Dco4PV1g8h8.jpg
Atributes in url on "/new" page - https://pp.userapi.com/c848520/v848520764/f11ff/u_4eCRexeDo.jpg
Input values after click back button - https://pp.userapi.com/c849020/v849020764/f587b/x7f4Pixpd10.jpg
symfony google-maps url twig back
add a comment |
I write the address, press enter, a marker appears with the coordinates. I follow the instructions, go to the next page, the url parameters are transmitted with coordinates values.
If I press the button back, the hidden inputs in which must be coordinates, lose the necessary values, but the address remains the same. If I follow the instructions again, on the next page the coordinates are no longer transmitted to the URL, and at the end everything breaks down.
I dont wont to lose value of the coordinates before back button click.
It posible?
(/join - first page),
(/new - second page)
***/join.html.twig***
<div class="form-group col-md-1 add-address-wrapper">
<div class="move-from-above"> </div>
<button type="button" class="btn btn-default btn-sm btn-set-location" aria-label="Set location"
data-toggle="modal"
data-target="#filterLocationModal"
data-address-field="#{{form.address.vars.id}}"
data-latitude-field="#{{form.latitude.vars.id}}"
data-longitude-field="#{{form.longitude.vars.id}}">
<img src="{{ asset('Resources/public/images/icons/map-point.png') }}" alt="">
</button>
</div>
<div class="form-group col-md-4 padding-left-none padding-right-none coordinates">
<label>
{% trans %}Destination address{% endtrans %}
</label>
{{form_widget(form.latitude)}}
{{form_widget(form.longitude)}}
{{form_widget(form.address, {'attr': {'readonly': 'readonly', 'class': 'form-control'}})}}
{{form_errors(form.address)}}
</div>
***/TripRequestController.php***
/**
* Creates a new tripRequest entity.
*
* @Route("/new", name="request_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
if (!$this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) {
throw $this->createAccessDeniedException();
}
$tripRequest = $this->container->get('autotracker.trip_request')->getNewRequestStub($this->getUser());
if ($filterDate = $request->query->get('trip_date')) {
$tripRequest->setTripDate(new DateTime($filterDate, new DateTimeZone('UTC')));
}
if ($filterAddress = $request->query->get('dest_addr')) {
$tripRequest->getDestinationWaypoints()[0]->setAddress($filterAddress);
}
if ($filterLatitude = $request->query->get('dest_lat')) {
$tripRequest->getDestinationWaypoints()[0]->setLatitude($filterLatitude);
}
if ($filterLongitude = $request->query->get('dest_long')) {
$tripRequest->getDestinationWaypoints()[0]->setLongitude($filterLongitude);
}
$form = $this->createForm(
'AutotrackerRequestBundleFormTripRequestType',
$tripRequest,
['view_timezone' => $this->getUser()->getTimezone()]
);
$form->add('create', SubmitType::class, [
'label' => 'Create request',
])
->add('create_and_search', SubmitType::class, [
'label' => 'Create and initiate search',
]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($tripRequest);
$em->flush();
if ($form->get('create_and_search')->isClicked()) {
return $this->redirectToRoute('request_edit', [
'id' => $tripRequest->getId(),
'_fragment' => 'driversearch',
]);
} else {
return $this->redirectToRoute('request_index');
}
}
$mapService = $this->container->get('autotracker.service.geo');
return $this->render('AutotrackerRequestBundle:TripRequest:new.html.twig', array(
'tripRequest' => $tripRequest,
'form' => $form->createView(),
'tz' => $this->getUser()->getDateTimeZone(),
'map' => $mapService->getGoogleMap($tripRequest->getClientAgency()),
'geocoderUrl' => $mapService->getGoogleGeocoderUrl(),
));
}
/**
* Join existing trip page.
*
* @Route("/join", name="request_join")
* @Method({"GET", "POST"})
*/
public function joinAction(Request $request)
{
$user = $this->getUser();
$tz = $user->getDateTimeZone();
$agency = $user->getAgency();
$em = $this->getDoctrine()->getManager();
$formBuilder = $this->createFormBuilder();
$formBuilder
->add('address', TextType::class, [
'constraints' => [
new NotBlank(),
]
])
->add('latitude', HiddenType::class)
->add('longitude', HiddenType::class)
->add('address_autocomplete', PlaceAutocompleteType::class, [
'mapped' => false,
'api' => false,
'variable' => 'autocomplete_address_popup',
'components' => [AutocompleteComponentType::COUNTRY => 'md'],
'types' => [AutocompleteType::GEOCODE],
])
->add('favorites', EntityType::class, [
'mapped' => false,
'required' => false,
'placeholder' => 'Choose address',
'class' => 'AutotrackerUserBundle:FavoriteAddress',
'choices' => $agency->getFavoriteAddresses(),
'choice_label' => 'address',
])
->add('date', DateType::class, [
'label' => 'Date',
'widget' => 'single_text',
'input' => 'datetime',
'html5' => false,
'format' => 'dd.MM.yyyy',
])
->add('filter', SubmitType::class, [
'label' => 'Show requests',
])
->add('create', SubmitType::class, [
'label' => 'Create new request',
]);
$form = $formBuilder->getForm();
$form->handleRequest($request);
$tripList = ;
if ($form->isSubmitted() && $form->isValid()) {
$filterDate = $form->get('date')->getData()->setTime(0, 0);
$filterAddress = $form->get('address')->getData();
$filterLatitude = $form->get('latitude')->getData();
$filterLongitude = $form->get('longitude')->getData();
if ($form->get('filter')->isClicked()) {
$tripList = $em->getRepository('AutotrackerRequestBundle:TripRequest')
->findJoinable(
$filterDate,
$filterAddress
);
} elseif ($form->get('create')->isClicked()) {
return $this->redirectToRoute('request_new', [
'trip_date' => $filterDate->format('Y-m-d'),
'dest_addr' => $filterAddress,
'dest_lat' => $filterLatitude,
'dest_long' => $filterLongitude,
]);
}
}
$mapService = $this->container->get('autotracker.service.geo');
return $this->render('triprequest/join.html.twig', [
'form' => $form->createView(),
'tz' => $tz,
'tripList' => $tripList,
'map' => $mapService->getGoogleMap($user->getAgency()),
'geocoderUrl' => $mapService->getGoogleGeocoderUrl(),
]);
}
Screenshots: https://prnt.sc/m2hvly
Coordinates in hiden input after click "Select adress" - https://pp.userapi.com/c847219/v847219764/16748d/Dco4PV1g8h8.jpg
Atributes in url on "/new" page - https://pp.userapi.com/c848520/v848520764/f11ff/u_4eCRexeDo.jpg
Input values after click back button - https://pp.userapi.com/c849020/v849020764/f587b/x7f4Pixpd10.jpg
symfony google-maps url twig back
add a comment |
I write the address, press enter, a marker appears with the coordinates. I follow the instructions, go to the next page, the url parameters are transmitted with coordinates values.
If I press the button back, the hidden inputs in which must be coordinates, lose the necessary values, but the address remains the same. If I follow the instructions again, on the next page the coordinates are no longer transmitted to the URL, and at the end everything breaks down.
I dont wont to lose value of the coordinates before back button click.
It posible?
(/join - first page),
(/new - second page)
***/join.html.twig***
<div class="form-group col-md-1 add-address-wrapper">
<div class="move-from-above"> </div>
<button type="button" class="btn btn-default btn-sm btn-set-location" aria-label="Set location"
data-toggle="modal"
data-target="#filterLocationModal"
data-address-field="#{{form.address.vars.id}}"
data-latitude-field="#{{form.latitude.vars.id}}"
data-longitude-field="#{{form.longitude.vars.id}}">
<img src="{{ asset('Resources/public/images/icons/map-point.png') }}" alt="">
</button>
</div>
<div class="form-group col-md-4 padding-left-none padding-right-none coordinates">
<label>
{% trans %}Destination address{% endtrans %}
</label>
{{form_widget(form.latitude)}}
{{form_widget(form.longitude)}}
{{form_widget(form.address, {'attr': {'readonly': 'readonly', 'class': 'form-control'}})}}
{{form_errors(form.address)}}
</div>
***/TripRequestController.php***
/**
* Creates a new tripRequest entity.
*
* @Route("/new", name="request_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
if (!$this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) {
throw $this->createAccessDeniedException();
}
$tripRequest = $this->container->get('autotracker.trip_request')->getNewRequestStub($this->getUser());
if ($filterDate = $request->query->get('trip_date')) {
$tripRequest->setTripDate(new DateTime($filterDate, new DateTimeZone('UTC')));
}
if ($filterAddress = $request->query->get('dest_addr')) {
$tripRequest->getDestinationWaypoints()[0]->setAddress($filterAddress);
}
if ($filterLatitude = $request->query->get('dest_lat')) {
$tripRequest->getDestinationWaypoints()[0]->setLatitude($filterLatitude);
}
if ($filterLongitude = $request->query->get('dest_long')) {
$tripRequest->getDestinationWaypoints()[0]->setLongitude($filterLongitude);
}
$form = $this->createForm(
'AutotrackerRequestBundleFormTripRequestType',
$tripRequest,
['view_timezone' => $this->getUser()->getTimezone()]
);
$form->add('create', SubmitType::class, [
'label' => 'Create request',
])
->add('create_and_search', SubmitType::class, [
'label' => 'Create and initiate search',
]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($tripRequest);
$em->flush();
if ($form->get('create_and_search')->isClicked()) {
return $this->redirectToRoute('request_edit', [
'id' => $tripRequest->getId(),
'_fragment' => 'driversearch',
]);
} else {
return $this->redirectToRoute('request_index');
}
}
$mapService = $this->container->get('autotracker.service.geo');
return $this->render('AutotrackerRequestBundle:TripRequest:new.html.twig', array(
'tripRequest' => $tripRequest,
'form' => $form->createView(),
'tz' => $this->getUser()->getDateTimeZone(),
'map' => $mapService->getGoogleMap($tripRequest->getClientAgency()),
'geocoderUrl' => $mapService->getGoogleGeocoderUrl(),
));
}
/**
* Join existing trip page.
*
* @Route("/join", name="request_join")
* @Method({"GET", "POST"})
*/
public function joinAction(Request $request)
{
$user = $this->getUser();
$tz = $user->getDateTimeZone();
$agency = $user->getAgency();
$em = $this->getDoctrine()->getManager();
$formBuilder = $this->createFormBuilder();
$formBuilder
->add('address', TextType::class, [
'constraints' => [
new NotBlank(),
]
])
->add('latitude', HiddenType::class)
->add('longitude', HiddenType::class)
->add('address_autocomplete', PlaceAutocompleteType::class, [
'mapped' => false,
'api' => false,
'variable' => 'autocomplete_address_popup',
'components' => [AutocompleteComponentType::COUNTRY => 'md'],
'types' => [AutocompleteType::GEOCODE],
])
->add('favorites', EntityType::class, [
'mapped' => false,
'required' => false,
'placeholder' => 'Choose address',
'class' => 'AutotrackerUserBundle:FavoriteAddress',
'choices' => $agency->getFavoriteAddresses(),
'choice_label' => 'address',
])
->add('date', DateType::class, [
'label' => 'Date',
'widget' => 'single_text',
'input' => 'datetime',
'html5' => false,
'format' => 'dd.MM.yyyy',
])
->add('filter', SubmitType::class, [
'label' => 'Show requests',
])
->add('create', SubmitType::class, [
'label' => 'Create new request',
]);
$form = $formBuilder->getForm();
$form->handleRequest($request);
$tripList = ;
if ($form->isSubmitted() && $form->isValid()) {
$filterDate = $form->get('date')->getData()->setTime(0, 0);
$filterAddress = $form->get('address')->getData();
$filterLatitude = $form->get('latitude')->getData();
$filterLongitude = $form->get('longitude')->getData();
if ($form->get('filter')->isClicked()) {
$tripList = $em->getRepository('AutotrackerRequestBundle:TripRequest')
->findJoinable(
$filterDate,
$filterAddress
);
} elseif ($form->get('create')->isClicked()) {
return $this->redirectToRoute('request_new', [
'trip_date' => $filterDate->format('Y-m-d'),
'dest_addr' => $filterAddress,
'dest_lat' => $filterLatitude,
'dest_long' => $filterLongitude,
]);
}
}
$mapService = $this->container->get('autotracker.service.geo');
return $this->render('triprequest/join.html.twig', [
'form' => $form->createView(),
'tz' => $tz,
'tripList' => $tripList,
'map' => $mapService->getGoogleMap($user->getAgency()),
'geocoderUrl' => $mapService->getGoogleGeocoderUrl(),
]);
}
Screenshots: https://prnt.sc/m2hvly
Coordinates in hiden input after click "Select adress" - https://pp.userapi.com/c847219/v847219764/16748d/Dco4PV1g8h8.jpg
Atributes in url on "/new" page - https://pp.userapi.com/c848520/v848520764/f11ff/u_4eCRexeDo.jpg
Input values after click back button - https://pp.userapi.com/c849020/v849020764/f587b/x7f4Pixpd10.jpg
symfony google-maps url twig back
I write the address, press enter, a marker appears with the coordinates. I follow the instructions, go to the next page, the url parameters are transmitted with coordinates values.
If I press the button back, the hidden inputs in which must be coordinates, lose the necessary values, but the address remains the same. If I follow the instructions again, on the next page the coordinates are no longer transmitted to the URL, and at the end everything breaks down.
I dont wont to lose value of the coordinates before back button click.
It posible?
(/join - first page),
(/new - second page)
***/join.html.twig***
<div class="form-group col-md-1 add-address-wrapper">
<div class="move-from-above"> </div>
<button type="button" class="btn btn-default btn-sm btn-set-location" aria-label="Set location"
data-toggle="modal"
data-target="#filterLocationModal"
data-address-field="#{{form.address.vars.id}}"
data-latitude-field="#{{form.latitude.vars.id}}"
data-longitude-field="#{{form.longitude.vars.id}}">
<img src="{{ asset('Resources/public/images/icons/map-point.png') }}" alt="">
</button>
</div>
<div class="form-group col-md-4 padding-left-none padding-right-none coordinates">
<label>
{% trans %}Destination address{% endtrans %}
</label>
{{form_widget(form.latitude)}}
{{form_widget(form.longitude)}}
{{form_widget(form.address, {'attr': {'readonly': 'readonly', 'class': 'form-control'}})}}
{{form_errors(form.address)}}
</div>
***/TripRequestController.php***
/**
* Creates a new tripRequest entity.
*
* @Route("/new", name="request_new")
* @Method({"GET", "POST"})
*/
public function newAction(Request $request)
{
if (!$this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) {
throw $this->createAccessDeniedException();
}
$tripRequest = $this->container->get('autotracker.trip_request')->getNewRequestStub($this->getUser());
if ($filterDate = $request->query->get('trip_date')) {
$tripRequest->setTripDate(new DateTime($filterDate, new DateTimeZone('UTC')));
}
if ($filterAddress = $request->query->get('dest_addr')) {
$tripRequest->getDestinationWaypoints()[0]->setAddress($filterAddress);
}
if ($filterLatitude = $request->query->get('dest_lat')) {
$tripRequest->getDestinationWaypoints()[0]->setLatitude($filterLatitude);
}
if ($filterLongitude = $request->query->get('dest_long')) {
$tripRequest->getDestinationWaypoints()[0]->setLongitude($filterLongitude);
}
$form = $this->createForm(
'AutotrackerRequestBundleFormTripRequestType',
$tripRequest,
['view_timezone' => $this->getUser()->getTimezone()]
);
$form->add('create', SubmitType::class, [
'label' => 'Create request',
])
->add('create_and_search', SubmitType::class, [
'label' => 'Create and initiate search',
]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($tripRequest);
$em->flush();
if ($form->get('create_and_search')->isClicked()) {
return $this->redirectToRoute('request_edit', [
'id' => $tripRequest->getId(),
'_fragment' => 'driversearch',
]);
} else {
return $this->redirectToRoute('request_index');
}
}
$mapService = $this->container->get('autotracker.service.geo');
return $this->render('AutotrackerRequestBundle:TripRequest:new.html.twig', array(
'tripRequest' => $tripRequest,
'form' => $form->createView(),
'tz' => $this->getUser()->getDateTimeZone(),
'map' => $mapService->getGoogleMap($tripRequest->getClientAgency()),
'geocoderUrl' => $mapService->getGoogleGeocoderUrl(),
));
}
/**
* Join existing trip page.
*
* @Route("/join", name="request_join")
* @Method({"GET", "POST"})
*/
public function joinAction(Request $request)
{
$user = $this->getUser();
$tz = $user->getDateTimeZone();
$agency = $user->getAgency();
$em = $this->getDoctrine()->getManager();
$formBuilder = $this->createFormBuilder();
$formBuilder
->add('address', TextType::class, [
'constraints' => [
new NotBlank(),
]
])
->add('latitude', HiddenType::class)
->add('longitude', HiddenType::class)
->add('address_autocomplete', PlaceAutocompleteType::class, [
'mapped' => false,
'api' => false,
'variable' => 'autocomplete_address_popup',
'components' => [AutocompleteComponentType::COUNTRY => 'md'],
'types' => [AutocompleteType::GEOCODE],
])
->add('favorites', EntityType::class, [
'mapped' => false,
'required' => false,
'placeholder' => 'Choose address',
'class' => 'AutotrackerUserBundle:FavoriteAddress',
'choices' => $agency->getFavoriteAddresses(),
'choice_label' => 'address',
])
->add('date', DateType::class, [
'label' => 'Date',
'widget' => 'single_text',
'input' => 'datetime',
'html5' => false,
'format' => 'dd.MM.yyyy',
])
->add('filter', SubmitType::class, [
'label' => 'Show requests',
])
->add('create', SubmitType::class, [
'label' => 'Create new request',
]);
$form = $formBuilder->getForm();
$form->handleRequest($request);
$tripList = ;
if ($form->isSubmitted() && $form->isValid()) {
$filterDate = $form->get('date')->getData()->setTime(0, 0);
$filterAddress = $form->get('address')->getData();
$filterLatitude = $form->get('latitude')->getData();
$filterLongitude = $form->get('longitude')->getData();
if ($form->get('filter')->isClicked()) {
$tripList = $em->getRepository('AutotrackerRequestBundle:TripRequest')
->findJoinable(
$filterDate,
$filterAddress
);
} elseif ($form->get('create')->isClicked()) {
return $this->redirectToRoute('request_new', [
'trip_date' => $filterDate->format('Y-m-d'),
'dest_addr' => $filterAddress,
'dest_lat' => $filterLatitude,
'dest_long' => $filterLongitude,
]);
}
}
$mapService = $this->container->get('autotracker.service.geo');
return $this->render('triprequest/join.html.twig', [
'form' => $form->createView(),
'tz' => $tz,
'tripList' => $tripList,
'map' => $mapService->getGoogleMap($user->getAgency()),
'geocoderUrl' => $mapService->getGoogleGeocoderUrl(),
]);
}
Screenshots: https://prnt.sc/m2hvly
Coordinates in hiden input after click "Select adress" - https://pp.userapi.com/c847219/v847219764/16748d/Dco4PV1g8h8.jpg
Atributes in url on "/new" page - https://pp.userapi.com/c848520/v848520764/f11ff/u_4eCRexeDo.jpg
Input values after click back button - https://pp.userapi.com/c849020/v849020764/f587b/x7f4Pixpd10.jpg
symfony google-maps url twig back
symfony google-maps url twig back
edited Jan 3 at 12:08
Николай Г
asked Jan 3 at 10:11
Николай ГНиколай Г
13
13
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54020158%2flose-google-map-coordinates-on-back-button%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54020158%2flose-google-map-coordinates-on-back-button%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown