Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Token encoding/decoding problem..............

Featured Replies

I have done a straignt conversion of my 6-file database to FMP 7.0 and am having problems displaying passed token data on my web pages. (this problem did not exist in FMP 6.0)

I need to know the best way to handle tokens that are passed onto and displayed in a number of subsequent web pages. I have used "fmxslt:url_decode" successfully in displaying tokens on the FIRST page after their creation, but on subsequent pages this does not work. The token data I use in newly created records does not appear to be a problem even 3 or 4 pages downstream from where the token was created.

Any assistance will be greatly appreciated.......roadrunner(Ray)

If you pass on the token to further pages you have to encode it again with fmxsl:url_encode()

  • Author

Hi Martin, I have tried this and it did not work. I encoded the token in UTF-8. I will try this again and report back.............Thanks, roadrunner(ray)

  • Author

The first page that receives the token displays it OK, using this statement:

<xsl:value-of

select="fmxslt:url_decode($request-query/fmq:query/fmq:parameter

[@name= '-token.1'], 'UTF-8')"/>

This page then passes the token along to the next page using a "Form", this, I believe is where the problem comes in. I have tried encoding this statement with no success. Hope someone has a suggestion on how to do this.

<input type="hidden" name="-token.1"

value="{$request-query/fmq:query/fmq:parameter[@name

= '-token.1']}"/>

The next page displays the token using the same coding as the previous page:

<xsl:value-of

select="fmxslt:url_decode($request-query/fmq:query/fmq:parameter

[@name= '-token.1'], 'UTF-8')"/>

Thanks for any and all assistance with this problem............ roadrunner(ray)

According to the CWP guide, for fmxslt:url_decode, you can't specify the encoding as a second parameter.

<xsl:value-of

select="fmxslt:url_decode($request-query/fmq:query/fmq:parameter

[@name= '-token.1'], 'UTF-8')"/>

-->

<xsl:value-of

select="fmxslt:url_decode($request-query/fmq:query/fmq:parameter

[@name= '-token.1'])"/>

  • Author

Martin, I tried displaying the token with and without the UTF-8 parameter and it displays OK either way. My problem, I believe, is how to encode the token being sent to the next page via the "Form" coding:

<input type="hidden" name="-token.1"

value="{$request-query/fmq:query/fmq:parameter[@name

= '-token.1']}"/>

If you have any thoughts on how this might be done they would be much appreciated.

Thanks,....roadrunner(Ray)

Again: the second parameter is not specified in url_decode, and I would not use it in your place (you might run later in problems).

The form encodes your token automatically. However, what you have to do in the input tag is also to decode the token, otherwise you have a double encoding:

<input type="hidden" name="-token.1"

value="{fmxslt:url_decode($request-query/fmq:query/fmq:parameter[@name

= '-token.1'])}"/>

However, if you use the token frequently, why not decode it once, save it in a variable and use the variable across the stylesheet? This makes your code more readable and more efficient, because the url_decode function and the XPath parser are used only once.

Before <xsl:template>:)

<xsl:variable name="mytoken" select="fmxslt:url_decode($request-query/fmq:query/fmq:parameter[@name

= '-token.1'])"

Within the template:

e.g. <xsl:value-of select="$mytoken"/>

e.g. <input type="hidden" value="{$mytoken}"/>

  • Author

Hi Martin, your suggestion about setting up a variable is probably the best way to handle passing these tokens and then displaying/using them. I have not ventured into using the sessions feature but I would imagine this is also a possibility.

I did not realize that the Form would also encode the token, this probably accounts for some of my problems of double encoding. I will use variables and let you know how this works......Many thanks, ...........roadrunner(Ray)

  • Author

Martin, wanted to let you know your suggestion to use variables "worked like a charm" so to speak........ Many thanks for your efforts...........roadrunner(Ray)

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.