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.

Edit a Value List via web PHP API (not using values from field)

Featured Replies

I would like to edit a value list via a web interface- I have done this using a field ("Use values from field"), but that [I incorrectly assumed, see doughemi's suggestion below!] requires adding/editing a record for each value, while (if possible) the textarea box would allow the editing of the whole value list at once.

Genx showed how to display a value list...

$layout = $fm->getLayout('my_template');

$list = array_map("htmlentities",(array)$layout->getValueList('my_list'));

I am hoping there is some easy way to send back an edited valuelist…  We are using Filemaker Server 11 (not advanced).

Thanks in advance!

Edited by Dave Carmean

Your values do not necessarily need to be in separate records.  You can use a field in one record with a return-delimited list of values to create a value list.

I use a one-record utility table for things like this.  Your php code would look something like this:

$layout = $fm->getLayout('YourLayout');
$list = array_map("htmlentities",(array)$layout->getValueList('YourValueList'));
$newlist = $list;
//
//modify your $newlist array here
//
//convert the array to a return-delimited string
$newString = implode("\n",$newlist );
// now upload it to the database in a field named "vlfield" in utility table named "yourUtilityTable"
$getstuff = $fm->newFindAllCommand('yourUtilityTable');
$result = $getstuff->execute();
$records = $result->getRecords();
$myRecord = $records[0];
$myRecID = $myRecord->getRecordId();
$sendNewVL = $fm->newEditCommand('yourUtilityTable', $myRecID);
$sendNewVL -> setField('vlfield', $newString);
$result2 = $sendNewVL->execute();
//return-delimited list is now in vlfield.  Use the values from vlfield to create your value list.

 

  • Author

So simple that I completely missed the possibility.  That is very, very convenient.  I appreciate your help.  Thank you for your time!  

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.