Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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


This topic is 7079 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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)

Posted

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)

Posted

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'])"/>

Posted

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)

Posted

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}"/>

Posted

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)

This topic is 7079 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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