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.

ValueListItem in logical "if" statement

Featured Replies

Hello,

Is it possible to test against a valuelistitem in an if directive?

Example:

<select name="from_the_list">

[FMP-ValueList:theList, list=myList]

<option value="[FMP-ValueListItem]">

[FMP-if:ValueListItem.eq.specificItem]

Display custom item

[FMP-else]

[FMP-ValueListItem]

[/FMP-if]

</option>

[/FMP-ValueList]

</select>

The code above doesn't seem to work for me. Thank you in advance for any insight.

Bradley

In theory your code should work.

Good Luck.

Garry

  • Author

Thank you for your post reply.

I think so, too.

I was thinking it was a meta-FMP tag, so I tried {} as used in the Inline tag... in all various forms.

No success. Maybe it just doesn't work.

Bradley

I do not think it is correct code.

How the IF can validate on server, when user is selecting something in browser?

You have to select something in browser, submit that choice to WebCompanion and on next page you can have the IF evaluation.

Anatoli,

According to the CDML Reference Database "ValueListItem" can be used as a "left-hand" argument in an "IF" tag.

All of Bradley's processing is intended for the server, as it is setting-up the "Select" tags.

All the best.

Garry

In that case you are right Garry and I misunderstand the problem. If the IF is processed before the page is sent as a reaction to already entered value, it can work.

If the IF is intended to be processed, as I've originally understood as reaction to user choice, then it is not correct way.

When I've got stuck in such problem, after 5-10 minutes I'll give up and I am going for different logic:

IF value in field = specificItem

do this code -- Display custom item

Else

do another code <select> value list </select>

Endif

HTH

  • Author

Thank you for you post replies.

Yes, the value list should be processed by the WC as it is generated for the Web page. That's why I thought it would be natural to test the list values against a specific value while processing.

Bradley

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.