Welcome Guest, Not a member yet? Register   Sign In
Mangled URI's
#1

[eluser]bparker[/eluser]
Hi,

I am having some trouble with URI's. I'm sure someone will have come accross this before, but i can't even think of a simple description for it to help norrow my searching for an answer!!!

I have a controller called 'search' which i can access via www.mydomain.com/search (accessing the 'index' method)

this contains a search form, which when submitted returns from the 'results' method.

Normally this works fine, but every so often, insead of returning from the submit with the url www.mydomain.com/search/results i instead get www.mydomain.com/search/search/results

This gives me just the index method again, which is obviously no good.

Initially i thought it may be a browser bug, but having tried in various browsers, it always seems to happen sooner or later.

The odd thing is i can't seem to identify the offending action which causes it to happen. Sometimes, even without altering any source code, after browsing a few pages, it just suddenly happens.

The second odd point is that it will eventually get back on track. entering the site again sometimes cures the problem, i guess since i then have a clean url in part, but cleaning the url alone won't fix it.

does anyone have any thoughts on what may be causing this? i am completely out of ideas!

P.S. even a way of describing this so i can go off and google it would be a help!!!)
#2

[eluser]Colin Williams[/eluser]
You're probably using a relative path for your form action ("search/results") when you need an absolute path ("<?php print site_url('search/results') ?>")
#3

[eluser]bparker[/eluser]
Damn it!

Sadly that hasn't fixed the problem completely, i still get occasional mangled url's!!!!

anyone have any other thoughts?

EDIT: I think i may have narrowed the cause...

I am using jquery for client side scripts. I also include jquery.autocomplete.js.

It seems using the autocomplete increases the chances of the oerror happening....

does this mean anything to anyone?
#4

[eluser]bparker[/eluser]
ok, to add to that, i may be wrong but it seems if i start an autocomplete, get the results, but escape, and don't select a result, it seems to imcrease the chances or the problem occuring...
#5

[eluser]bparker[/eluser]
OK, ignore me, fixed using the method above....




Theme © iAndrew 2016 - Forum software by © MyBB