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.

[FMP-tags] within javascript

Featured Replies

  • Newbies

Hello! I need your help!

I'm using javascript on a page to change a jumpbox dynamically. This page also connects a FMP database and I'm having difficulties using [FMP-tags] within my javascript! It just won't work.

Here are some details about my script. The script checks to see what selection the user makes on a "select-tag" (i mean <select> ) and then dynamically loads a second "select-tag" accordingly to his choice. I use writeln(...) to display the text and also the <script>...</script> does not produce all the html page but only a certain part, the part that needs to be dynamic.

Since I'm using a script to load and modify the user's selection into the db, I have to work with <script>...</script>. My problem is the following: when a user enters the site to modify his "profile", the script has no memory so it cannot put the proper user selection in the select-tag. I have to go take it in the database. My solution was to display the field as the first option. But since I'm inside a <script> I cannot access the database with [FMP-tags]...

I'm sure there is a way to do this, but how? Is this cause the javascript is executed/parsed before the [FMP-tags] ?

Thanx inadvance and PLEASE help me! smile.gif

The shopping cart solution which comes with FMPro 4 (I don't know about 5) uses javascript and includes. You may find an answer in that solution through the includes. Hope this is useful. Good luck.

------------------

Keith M. Davie

  • 3 weeks later...

quote:

Originally posted by MrHappy:

Hello! I need your help! ..........

..... I'm sure there is a way to do this, but how? Is this cause the javascript is executed/parsed before the [FMP-tags] ?


[FMP-tags] are processed on Server and they are not in page code at all, they are replaced by data from FM.

JS is send with page to the browser and then executed there in browsers.

Try do the IF from HTML and FM:

[FMP-If: LeftSide Operator RightSide ]

...HTML if condition is true...

[FMP-Else]

...HTML if condition is false...

[/FMP-If]

Hth

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.