mlindal Posted January 11, 2005 Posted January 11, 2005 In our custom filemaker solution using CDML, I want to create a Filemaker link in the filemaker database and have cdml correctly pass it through a browser. In the database there is a field called: relatedURL the cdml is: a href="[FMP-Field:Web_URL_Related_1]" target="-top"> [FMP-FIELD: Web_URL_Related_Desc_1]</a> This works fine for any url except if I want a FMPro type url. I want to be able to pass a url that might look something like: http:// xxx.com/FMPro?-db=dbase_.fp5&-format=detail.html&-token=[FMP-currenttoken]&-lay=ForWeb&CatalogNumber=24346&-script=Web_English&-find The token is the problem right now. The [fmp-currenttoken] does not work. Is there a way to do this?
Garry Claridge Posted January 11, 2005 Posted January 11, 2005 The [FMP-CurrentToken] tags are probably being rendered/replaced before the [FMP-Field] tags. Hence the embedded tag is not being rendered/replaced. You may be able use some Javascript to replace it. Or, you may be able to structure the HTML/URL to append the [FMP-CurrentToken] to the end of the URL. Good Luck. Garry
mlindal Posted January 12, 2005 Author Posted January 12, 2005 Garry, Correct. This is the problem - now how to solve? I created a javascript function gettokenurl(baseurl) { var newurl = baseurl; var finalurl = newurl; var pos=baseurl.IndexOf("FMPro?"); if (pos>=0) { newurl = baseurl + "&-token=[FMP-currenttoken]"; } return newurl; } And the tried to use it in the href="javascript:gettokenurl('[FMP-Field: relatedURL]')" But the link does nothing when clicking it. According to a Javascript site - javascript in the Url cannot look for a returned item. So it is close - but there must be something missing to append [fmp-currenttoken]
Garry Claridge Posted January 12, 2005 Posted January 12, 2005 Try this: <script> currtok = "[FMP-CurrentToken]"; fmurl = "[FMP-Field:Web_URL_Related_1]".replace(/[FMP-currenttoken]/i, currtok); document.write("<a href='" + fmurl + "' target='-top'> [FMP-FIELD: Web_URL_Related_Desc_1]</a>"); </script> Good Luck. Garry
mlindal Posted January 13, 2005 Author Posted January 13, 2005 Garry, Brilliant suggestion but taking your idea, I have simplified it even more. The secret was if the field contains 'FMPro?' we want to maintain the token and do a FMP query. So the code looks like. [FMP-IF: Web_URL_Related_3.cn.FMPro?]<a href="[FMP-Field: Web_URL_Related_3]&-format=detail.html&-lay=ForWeb&-token=[FMP-currenttoken]&-script=Web_English&-find"> [FMP-FIELD: Web_URL_Related_Desc_3]</a><br> [FMP-ELSE] <a href="[FMP-Field: Web_URL_Related_3]"> [FMP-FIELD: Web_URL_Related_Desc_3]</a> [/FMP-IF] Of course in a month or so, we change and start upgrading to PHP. Thanks!
Recommended Posts
This topic is 7324 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now