Jump to content

Trying obtain valuelist from my layouts


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

Recommended Posts

  • 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.


	require_once ('FileMaker.php');
	$fm = new FileMaker();
	$fm->setProperty('database', 'myDB');
	$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;





Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;


Link to comment
Share on other sites

  • 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.

Link to comment
Share on other sites


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>';


Link to comment
Share on other sites

  • 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
Link to comment
Share on other sites

This topic is 2731 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
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.