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.

Get valuelist (related values only) for web dropdown

Featured Replies

  • Newbies

Hello there,

I have created some CWP pages for my company and it has been doing great. Recently my boss wants me to changed some of the fields into an optional dropdown menu. I tried to create a value list in FileMaker and the did it this way in PHP:

$layoutObject = $fm->getLayout('form_api');

$noheads = $layoutObject->getValueList('nohead');

foreach ( $noheads as $nohead ){

$_SESSION['nohead'] .= "<option>".$nohead."</option>";

}

This works perfectly for the valuelists that show all values of a field but when it comes to valuelists that show only related value, it always return the result of the first record. So I modified it and it now looks as follows:

$record = $fm->getRecordById( 'form_api' , $_SESSION['ent']);

$NoObject = $record->getLayout('form_api');

$cnoheads = $NoObject->getValueList('cnohead');

foreach ( $cnoheads as $cnohead ){

$_SESSION['cnohead'] .= "<option>".$cnohead."</option>";

}

I thought it would return the right value this time as I actually got record by id so it should return the values according the to record id but that was not the case. The truth is that it still returns the values related to the first record.

Of course I can create a portal and loop through the related sets but there are over 20k records from the table I want to get value from. It sounds stupid looping 20k records to get values for a dropdown menu... Is there any way I can get the correct values using value list? Any help will be greatly appreciated!

Lou

  • Author
  • Newbies

Ah I have figured it out. Thank you!

How did you get it to work? I read this yesterday, but didn't understand why the 2nd scenario you mentioned didn't work.

wait a min... I just looked at it again. Was it because you were getting the layout object, then getting the value list from the layout, rather than retrieving the value list from the record object?

  • 4 months later...

I'm stuck on this problem too... I don't see any option to pull the value list from the Record. Hmmm...

Cuitw, can you post your solution?

Figured this one out actually, it was an issue with how the value list was being related to the layout, nothing to do with PHP.

Only difference actually is that I'm using the getValueListTwoFields instead of getValueList

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.