Jump to content

Passing tokens via links


Jul
 Share

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

Recommended Posts

Hi,

I need to pass tokens through a couple of pages via links.

I start by assinging tokens using javscript

..

URL = "&-token2=" + document.form1.date_installed_start.value;

..

On the next page I see those tokens and I insert the following link:

<A HREF="FMPro?-DB=example.fp5&-Format=record.htm&-Lay=web&-RecID=[FMP-CurrentRecID]&-token.1=[FMP-CurrentToken:1]&-token.2=[FMP-CurrentToken:2]&-token.3=[FMP-CurrentToken:3]&-token.4=[FMP-CurrentToken:4]&-max=1&-Edit">Edit Record</A>

However, when I click that link - tokens are not passed. They are empty on the record.htm page.

DOes anybody have an idea how can I fix it?

I have to use a link to edit next page.

Thank you very much

Link to comment
Share on other sites

Hi, Jul! Pardon me, 'cuz I don't know JavaScript...

If the 1st page is processed through FileMaker and the Web Companion, then I'd think your link on the 2nd page would work (although I'm not sure whether or not you intended to do the EDIT w/the link since I see only reference variables and no data variables to be changed by the edit, or if you wanted the link to just do a FIND for the appropriate record and then do the EDIT on the record.htm page). If you got to the next page where you see those tokens without going through FMP and WC, then I can see why you would just get blanks on the record.htm page since FMP/WC does not have a record of those values to pass along.

Sorry... hope that wan't too confusing.

--ST

Link to comment
Share on other sites

On the second page you can see the Token values! That is, some html with:

Here is Token 1: [FMP-CurrentToken:0]<br>

prints what you expect.

However, when submitting a "-edit" URL from the second page the Tokens are not passed to the third page. (I notice that the URL is not assiging any field values for the edit, and it has a -max parameter!)

We may have to see more of your pages to check what is happening.

Good Luck.

Garry

Link to comment
Share on other sites

Thank you for your help but I am still lost here.

Mybe I wasn't clear enough about what I am doing.

I have total of 4 pages - 3 html and 1 php page. On the first page users enter search parameters which are also recorded as tokens and click submit button. The second page is browse.htm - here users can navigate by clicking previous and next link buttons and tokens are present.

If they want to edit a record they click the following link:

<A HREF="FMPro?-DB=example.fp5&-Format=record.htm&-Lay=web&-RecID=[FMP-CurrentRecID]&-token.1=[FMP-CurrentToken:1]&-token.2=[FMP-CurrentToken:2]&-token.3=[FMP-CurrentToken:3]&-token.4=[FMP-CurrentToken:4]&-max=1&-Find">Edit Record</A>

(I changed Edit to Find, didn't help)

On the record.htm page they can edit a record. Tokens are empty in the URL on this page. After users are done, thei click "Save" button which action is save.php file that modifies the record in database.

After that I want them to be redirected back to the found records and continue browsing.

For that purpose on the save.php page I display a link 'Go back" that has original FileMaker search criteria. However, tokens are empty and FileMaker displayes all records.

I wonder if there is any way to pass thouse search parameters through pages. I have to use php script to edit a record - there is no way I could do that with CDML or javascript.

I will appreciate any thoughts on that I am lost...

Thanks a lot.

Jul

Link to comment
Share on other sites

Jul,

You say that the Tokens are empty on the "record.htm" page. However, when you view the source of a "browse" page, within a browser, the Token values are present!

Does this link, in a loaded page, have values (or the CDML):

<A HREF="FMPro?-DB=example.fp5&-Format=record.htm&-Lay=web&-RecID=[FMP-CurrentRecID]&-token.1=[FMP-CurrentToken:1]&-token.2=[FMP-CurrentToken:2]&-token.3=[FMP-CurrentToken:3]&-token.4=[FMP-CurrentToken:4]&-max=1&-Find">Edit Record</A>

Or, is it the "save.php" script page that has empty values?

You may have to show us your "save.php" script and the "record.htm" Format file to see where the Tokens are losing their way.

Good Luck.

Garry

Link to comment
Share on other sites

Hi, Jul! Is this correct?

page1 = search page (CDML) ... tokens are set

page2 = browse.htm (CDML) w/navigation links and EDIT RECORD link ... tokens seen; tokens set again

page3 = record.htm (CDML) w/SAVE button to save.php ... tokens not seen (in URL? how about page?)

page4 = save.php (PHP) ... tokens empty

To track tokens, I'd suggest temporarily putting [FMP-CurrentToken:1] , :2, :3, etc. visible somewhere on all pages to see what their values are at any given time. I do that until a project is done, and it helps a great deal...

token1 is [FMP-CurrentToken:1], token2 is [FMP-CurrentToken:2], etc.

I'm afraid PHP and JavaScript are not tools with which I feel comfortable yet, but you certainly CAN edit records using CDML... all you need is a -recID and the -edit action. We may need the browse.htm code, too, unless you're sure the tokens are reaching page 3 (record.htm).

--ST

P.S. I haven't had to store/recreate a search result but I'm pretty sure it has been discussed in the forums before, so if we are not able to help you, you might find what you need in the posts.

Link to comment
Share on other sites

Hi All,

Thank you for your help - I figured out my problem.

I typed token1, token2, etc instead of token.1, token.2, etc..:)

As soon as I fixed that - everything is working

Jul

Link to comment
Share on other sites

This topic is 6434 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
 Share

×
×
  • Create New...

Important Information

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