Jump to content

Some Simple Instructions on Tokens PLEASE!

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

Recommended Posts

I need some simple instructions on the use of tokens. I have purchased several books on FMP web development and all just gloss over the subject of tokens or perhaps I am just being particularly dense. I feel really stupid not being able to do this - it just shoudn't be that difficult but I am beating my head into a wall. I do not understand or cannot generalize the syntax to my problem. Can someone please break it down for me -

I want to do 3 things.

1) Set token on 1 page (users name from where they log in)

2) Display that token on 2nd page (Not from the db but from the token - just as a sanity check that it was actually set correctly.)

3) Use same token for all resulting searches.

I don't want to use the token in a URL.



Link to comment
Share on other sites

Hi, kele! I had a hard time w/tokens at first, too. They must be constantly renewed if you want to use them throughout your site and I got into the habit of showing the value of all tokens on every page until I finish the project because tracking token values can save you a lot of headaches when something isn't working right. I think Anatoli and others even use INCLUDES to make it easier to keep resetting them. I'm still not all that great at them, but here goes...


If you want to set the token value on page 1, I don't think you can have your text box input correspond to the FileMaker field "username"... You'll have to set the token from the user's input box. I'm not even sure you can, but if so, it'd be

<INPUT TYPE="text" NAME="-token.1">

In our systems, we just did not access the tokens until afterwards, e.g. we'd perform a FIND or whatever first, and then set the token to the value of a field from the resulting record on page 2 using

<INPUT TYPE="hidden" NAME="-token.1" VALUE="[FMP-field:username]">




On every page, I'd suggest putting

<INPUT TYPE="hidden" NAME="-token.1" VALUE="[FMP-CurrentToken:1]">

to carry the value of the token throughout your system. Of course, I think this means you have to have a form on every page... avoiding the URL may be tricky sometimes.

Hope this helps some...


Link to comment
Share on other sites

I am using that syntax I guess the problem may lay in my understanding of how the CDML gets integrated into the html.

Question 1:

A user logs in and the initial token gets set - I think that part is working but - how do I get that token to display on the results page - surely I don't just have a line of code that says (at least its not working when I just add that line).


Question 2:

Assuming that I am actually setting my token on the first page and then I use the

<INPUT TYPE="hidden" NAME="-token.1" VALUE="[FMP-Currenttoken:1]">

to keep passing the token along how do I then use that token in a search.

I have 3 forms on 1 page for narrowing a search. One to limit search by date, One by topic and 1 category.

I want to further limit those searches by adding the token value to the search. So that the search on date would actually be a search on date & user

So I tried this:

<form method=post action="FMPro" name="form2">

<input type=hidden name="-find">

<input type=hidden name="-db" value="XXX">

<input type=hidden name="-lay" value="web">

<input type=hidden name="-format" value="moddate.html">

<input type=hidden name="-max" value="55">

<input type=hidden name="-sortfield" value="Date">

<input type=hidden name="-sortorder" value="ascend">

<table border=0 cellpadding=3 cellspacing=0>

<p> <select name="This week" size=1>[FMP-valuelist: This week, list=weekdue]>

So where and how would I add in the additional find criteria provided by the token?

[FMP-field: user value=CurrentToken.1, HTML]?

Thanks for your help -


Link to comment
Share on other sites

->" (at least its not working when I just add that line)."

Then it has not been set. Is your client signing into the FMP protocol or your own sign-in db?

There is a demonstration in the Sample Files Forum (CDML Linking to the next record) which uses a token. You may or may not find that useful.

Link to comment
Share on other sites

This topic is 7151 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.