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.

Trying obtain valuelist from my layouts

Featured Replies

  • Newbies

Hey all,

Hoping someone can help me out. I am using a two server deployment with FileMaker Server 15. I have created a simple database with two fields, MemberID and Display. The display field has a static value list applied to it called YESNO and the values contain Yes,No.

When I call the getValueListTwoFields command, my web page displays an error 500. As soon as I remove the line $layout->getValueListTwoFields('YESNO'); and put in a simple array, my code works fine, I can retrieve data from a field but any attempt to list, display a valuelist causes the web page to fail. Anyone have any advice to offer, I've tried everything possible, made sure the db has webuser has the correct permissions - different iterations of code, including the deprecated getValueLists() command, but to no avail.

Thanks

	require_once ('FileMaker.php');
	
	$fm = new FileMaker();
	$fm->setProperty('database', 'myDB');
	$fm->setProperty('hostspec','myIP');
	$fm->setProperty('username','myUsername');
	$fm->setProperty('password','myPassword');
    
	
	$findCommand = $fm->newFindCommand('Members');
	$findCommand->addFindCriterion('MemberID', '1');


	$result = $findCommand->execute(); 


	$row = current($result->getRecords());

	$layout =& $fm->getLayout('Members');
    $values = $layout->getValueListTwoFields('YESNO');
	//$values = array(1,2,3,4,5);
    $valueList = '<select name="YESNO">';
    foreach($values as $value) {
        $valueList .= '<option value="' . $value . '">' . $value . '</option>';
    }
    $valueList .= '<select>';
    echo $valueList;

 

 

 

 

Error 500's description is pretty broad ("internal Server Error" is not very helpful!). The first thing to do is to check your server's access_log and error_log files for any clues.

What happens if you just print_r the $values?

$values = $layout->getValueListTwoFields('YESNO');
print_r ($values);
//Comment the rest out for testing
	//$values = array(1,2,3,4,5);
    //$valueList = '<select name="YESNO">';
    //foreach($values as $value) {
    //    $valueList .= '<option value="' . $value . '">' . $value . '</option>';
    //}
    //$valueList .= '<select>';
    //echo $valueList;

 

  • Author
  • Newbies

Hi Webko, as soon as I comment out the code you have highlighted and insert print_r($values); it comes up with a server error 500. In fact anything to do with php and Valuelists produces a server 500 error.

Doughemi, I can't seem to find any useful information in the logs in the Event viewer on Windows. I have also checked the IIS log files and that doesn't seem to have registered any error.

OK...

Back to the basics - you're sure the ValueList 'YESNO' is actually on the Members layout?

Why does 

$layout =& $fm->getLayout('Members');

Have that extra ampersand?

And you can always try for debugging:

$layout = $fm->getLayout('Members');
$valueListNames = $layout->listValueLists();
echo '<p><pre>'.print_r ($valueListNames).'</pre></p>';

 

  • Author
  • Newbies

I've removed the ampersand you identified.

added your code to list the valuelists on my layout, and it still brings up an server error 500. I've double checked that my basic file with two fields definitely has a value list YESNO attached to one of the fields on the Members layout. I've also attached full access privileges for my webuser, including the php extention.

Anything else I can check, wondering whether it is a two system bug, I would have thought you should have listed all values lists on a layout without any issue?

 

Edited by AJK

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.