Jump to content

Get valuelist (related values only) for web dropdown


cuitw
 Share

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

Recommended Posts

  • 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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • 4 months later...

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