• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

MapMe - Users Google Map

Next question - have you set up a route prefix to point to your controller?

Yep, my route prefix is set up as

Capture.webp

and dcXenMapMe/Route currently contains

PHP:
<?php
  
class dcXenMapMe_Route_index implements XenForo_Route_Interface

{

public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)

{

return $router->getRouteMatch('dcXenMapMe_ControllerPublic_Index', 'index', 'dcXenMapMe', $routePath);

}

}
 
Okay, that's looking good for the router. I'm actually having trouble understanding what is going wrong - could you give me a simple expected behaviour vs observed behaviour synopsis?
 
Okay, that's looking good for the router. I'm actually having trouble understanding what is going wrong - could you give me a simple expected behaviour vs observed behaviour synopsis?

Certainly can. I have a table for the markers that are to be placed on the googlemap which is as follows

Code:
CREATE TABLE IF NOT EXISTS `dc_MapMe_Markers` (
  `marker_id` int(11) NOT NULL auto_increment,
  `member_id` mediumint(8) NOT NULL,
  `lat` float(10,6) default NULL,
  `lon` float(10,6) default NULL,
  PRIMARY KEY  (`marker_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=536 ;

I enter into the field which will add my location, on this occasion being "Rochdale,UK" .....

Field looks like this

<form action="{xen:link dcXenMapMe}" method="post" class="xenForm AutoValidator ScratchpadQuickNote">
<dl class="ctrlUnit">
<dt><label for="ctrl_message">Add your location:</label></dt>
<dd><input type="text""message" id="ctrl_location" class="textCtrl"</input></dd>
</dl>
<dl class="ctrlUnit submitUnit">
<dt></dt>
<dd><input type="submit" value="Add" class="button primary" accesskey="s" /></dd>
</dl>
<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
</form>


Field looks like this I must say this part loses me, as Im not sure how it should know to process the results of this through the actionaddlocation function within my controller, which tbh is what I half thought someone was going to say is what I had done wrong.

The actionaddlocation function should then process "Rochdale,UK" through my geocoder function (which I have tested and works as expected) and then enter the results into the database. However this does not happen, instead I get the message "Unspecified error" in the overlay dropdown and no new entries have been added to the database.


 
The formtarget is still dcXenMapMe
<form action="{xen:link dcXenMapMe}" method="post" class="xenForm AutoValidator ScratchpadQuickNote">

and not dcXenMapMe/add-location
public function actionAddLocation()
{

i think that the form is sending the data to the false action!

try to add a die('here') as first line in your action to see if the form is sent to the right action
 
Ragtek is right, you need to use {xen:link dcXenMapMe/add-location} in order to instruct the controller to launch the actionAddLocation() method, otherwise it's going to be looking for actionIndex().
 
The formtarget is still dcXenMapMe
<form action="{xen:link dcXenMapMe}" method="post" class="xenForm AutoValidator ScratchpadQuickNote">

and not dcXenMapMe/add-location
public function actionAddLocation()
{
i think that the form is sending the data to the false action!

try to add a die('here') as first line in your action to see if the form is sent to the right action

Ahhh now you have answered one of my confusions. Now I know how it knows what to execute.

Added
public function actionAddLocation()

{
die('here');

and also <form action="{xen:link dcXenMapMe/add-location}" method="post" class="xenForm AutoValidator ScratchpadQuickNote">

Still get the same "unspecified error" and doesnt die, which would lead me to believe it is not executing said function? Correct?

Now my page is at forumlocation/dcXenMapMe/ ... so I am assuming that the above link is correct?

Thankyou for helping btw, its very much appreciated. Only hope one day I can be as good as you guys at this.
 
Oooooo shiny.... :) Will have a look at that, cheers. I really wish I had started with web programming instead of desktop LMAO. VB is so much easier when your used to it lol
Did you check the js output? (firebug, js console,..)
 
Remove 'AutoValidator' from the classes applied to the form so it submits without AJAX, then see what it reports back on submission.
 
Did you check the js output? (firebug, js console,..)

I did:

XenForo.init() time: 57 ms

Abort pending field validation...

Event: AutoValidationDataReceived

message: Okay

Event: AutoValidationComplete
Doesnt do anything else after that, again leading me to believe its not getting to that function?
 
Remove 'AutoValidator' from the classes applied to the form so it submits without AJAX, then see what it reports back on submission.

Still get the dropdown overlay from the top stating unspecified error.
 
Still get the dropdown overlay from the top stating unspecified error.

Scratch that comment, was being an idiot and hadnt saved the template.

Dont get any message, I just get redirected back to the same page
 
Can you track down where the execution path is going? Pepper your controller with die(__LINE__); commands all over the place and see if you can work it out.
 
Can you track down where the execution path is going? Pepper your controller with die(__LINE__); commands all over the place and see if you can work it out.


What loses me is that I have die('here'); at the very top of the file, and yet I get no error message with the validation removed. So I guess that means its not executing anything within that function at all
 
AAAAAAAAAAAAAAAAAAAAAAAhh
i've found it

Your router isn't right
PHP:
return $router->getRouteMatch('dcXenMapMe_ControllerPublic_Index', 'index', 'dcXenMapMe', $routePath)
You're sending all data to the index action!

should be
return $router->getRouteMatch('dcXenMapMe_ControllerPublic_Index', $routePath', 'dcXenMapMe'
 
AAAAAAAAAAAAAAAAAAAAAAAhh
i've found it

Your router isn't right
PHP:
[FONT=monospace][COLOR=#000000][COLOR=#007700]return [/COLOR][COLOR=#0000bb]$router[/COLOR][COLOR=#007700]->[/COLOR][COLOR=#0000bb]getRouteMatch[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]'dcXenMapMe_ControllerPublic_Index'[/COLOR][COLOR=#007700], [/COLOR][COLOR=#dd0000]'index'[/COLOR][COLOR=#007700], [/COLOR][COLOR=#dd0000]'dcXenMapMe'[/COLOR][COLOR=#007700], [/COLOR][COLOR=#0000bb]$routePath[/COLOR][COLOR=#007700])
[/COLOR][/COLOR][/FONT]

You're sending all requests to the index action

$routepath is the SECOND parameter

LOL ... you seem to have mass BBCode in your excitement
 
Doesnt even load the page when I set it to that unfortunatly ...

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/huskyown/public_html/huskydev/library/dcXenMapMe/Route/index.php on line 7
 
yes, f*cking copying and wysiwyg editor^^
should be ok now:)

YOU ARE AN F************************************ GENIOUS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I now get the message "here" which is the die('here'); I would expect ..........

Thankyou so very very much Kier & ragtek .... You've spent a lot of time tonight helping me out, and its massively appreciated ..... THIS is the kinda dev community we want!! :)
 
Top Bottom