Routing with dynamic parameters - Am i missing something obvious?

Believe it or not I have yet to experiment with routing and dynamic values in Wappler
It’s quite an brilliant addition as coding manually in your .htaccess file was and remains a pain in the backside.

BUT i am clearly missing something in the logic

I start with a typical bootstrap table with Anchor buttons

The links are intiially:

contact.php?contactid={{contactid}}

This calls contact.php

with query

image

So everything OK up till this point

However want the link to be in the format /contact/3/

Now I add routing

image

Generate and Upload the routes giving:

image

and change the link in app connect

This adds

‘contact/{{contactid}}/’

I take out the unwanted single quotes (still a bug report in on that one I believe)

contact/{{contactid}}/

The link works correctly

image

However the quuery does not return any data

I am sure I am missing something simple, anyone spot what it is?

Could the issue be similar to this?

The routing feature works very well generally, but there are one or two issues I haven’t resolved or understood yet.

Thanks Tom.

Following what i think is suggested in the post you linked,

In contact.php (the routed to page) I change

image

to

image

If so, didn’t fix it.

Finally found then issue,

switched connection back to

image

Then manually added ./ to the start of the link

image

Glad you found the problem. I was just looking at a site where I first tried out the routing feature. I didn’t use ‘params’ either - but nor did I start links with ‘./’. Still a few mysteries to uncover with routing.

@Hyperbytes,

I am having the same difficulty as you described, but I am not clear on how you resolved the issue. Adding the ./ in the beginning of the link path did not resolve the data not appearing for me.

This is worrying scott, i don’t even remember creating this post but I obviously did. Hence I need to check back on old sites/ test sites to see what this was about.

However I can see the difference between the two routing paths if this helps (apologies if you already know this)

/contact/{{contactid}} means relative to the site root

./contact/{{contactid}} means relative to the current directory

Hi @Hyperbytes,

The path isn’t the issue I’m having, it is the data not showing up. The routed parameter in the URL is not being retrieved by the query.

Well my simple error was so simple it took me half the day to find it… :crazy_face: Even after finding it, I am :face_with_symbols_over_mouth: at myself for it.

As stated in the documentation, https://docs.wappler.io/t/url-rewriting-with-wappler/6254 :

The URL parameters should be entered exactly how they are defined in the App Structure, with a colon in front of them: :parameter

So… batchId is not the same as batchid

@Hyperbytes, I’m not sure if the params vs. query difference is due to SPA vs. non-SPA, but on my SPA, query did not work, but params did work.