Replies: 1 comment
|
I found a solution but don't know if it is the best. But it works. It uses a key of 0, then removes the 0 and replaces it with the dynamic projectID value. It feels kludgy, so if there is a more elegant way to achieve this, please let me know. This seems like it would be a common issue for developers. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I have a project navigator that constructs the URL from a pull-down menu that has values of IDs. Since the key for the URL is the ID, the question becomes how to determine the route URL for the page. This code lives in a header navigation code block so the URL will vary through out the app navigation. So I might be on a page with URL /project/show and have an id of 3, I'd want a URL for /project/show/3. Or I might be on /milestone/show and I select from the pulldown id 33. I'd want /milestone/show/33 for the URL.
Normally I'd fetch the current controller and the current action from the URL scope. But how do I construct all this for use in jQuery code to call a new page load as described above when I click on the Go button (after selecting the project I want from the dropdown menu.?)
This is the function that encapsulates all this. But the wrinkle is that my dev server uses rewrite and the test/production server does not (yet) have rewrite configured as they don't use Commandbox but my local development does. Hence I have been trying to use urlFor() as it will insert the "/index.cfm/" when needed. If controller and action are known, I can insert into routes.cfm a "base" route for the controller and action, leaving just the key to be appended to the base. But with all three dynamic, I am not seeing away to modify this to use urlFor() for constructing this URL.
All reactions