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.

Featured Replies

  • Newbies

Ok I searched the forums here and haven't found quite the solution I'm looking for. I'm relatively new at PHP, but I've been learning quickly as I go in creating this Filemaker API site.

Basically the problem i am running into is updating values in a checkbox set on one of my filemaker layouts.

When I do a find command and retrieve the data from filemaker, it gives me the checkbox values in what looks like a space delimited list, e.g. '214.0 214.29 215.9'

Upon further investigation, doing a urlencode($returnvalue) i get this:

'214.0%0A214.29%0A215.9'

If I try to add another %0A and the next value to the end of the url encoded string, then send it back to filemaker with a urldecode, I dont get any checkboxes checked back in filemaker.

How can I add a value to the list and send it back to filemaker?

You could perhaps avoid the problem by:

1) creating a new text field in FileMaker called "updated_checkbox_values"

2) send your value back there without any urldecode

3) set your actual checkbox set to an auto-enter calculation with the expression

substitute( "updated_checkbox_values" ; "%0A" ; "¶" )

[the thing between the last pair of quotes may not come out correctly here, if not it is the paragraph symbol, looks like a backwards-P, there is a button for it in the define calculation window... someone told me the other day what the correct technical name of it was, but I've forgotten]

4) set the auto-enter calculation to 'replace existing values'

Because the auto-enter calculation replaces existing values, it should update itself every time the PHP file posts back a value to the "updated_checkbox_values" field.

Keep your PHP "find" on the original field (the one that is now an auto-enter).

You may need to experiment with variations of the above as I am not 100% familiar with the encodings involved with checkboxes in PHP.

I've subscribed to this thread though so come back if you've any problems.

Yours

James

  • Author
  • Newbies

Thanks for the reply! The paragraph symbol is what I was missing.. The checkbox field is actually contained in a related table, so the auto-calculated field wasn't working right I think.. What I ended up doing as a solution was the following (for anybody else with this issue):

1. In PHP, retrieve the checkbox field, which for example returns 102.1 102.2

2. In PHP, do a urlencode on the string to get 102.1%0A1.2.2

3. Append the new value on the end with another %0A string (102.1%0A102.2%0A102.3)

4. Send new string to filemaker in a temp field (temp_code_field)

5. In filemaker, create a script with SetField(substitute(checkbox_set_field, "%0A", "¶"))

6. Call the script on Record Commit in the Layout parameters.

Works like a charm.

  • 1 month later...
  • Newbies

The %0A is a line feed, chr(10) in PHP, but FM, on the Mac anyway, wants carriage returns. I solved this problem by first replacing the line feeds with carriage returns like this:

str_replace(chr(10), chr(13), $chboxVals);

Then, to add a new value to an existing checkbox set, I did this:

$chboxVals = 'new value' . chr(13) . $chboxVals;

Seems to work fine.

Sounds like your problem is solved, but if anyone else would like to read up on checkboxes + php + filemaker, you might want to check out my article on the topic in Advisor:

http://my.advisor.com/doc/19601

  • 5 months later...

Jonathon, I saw your fix in your article at Advisor and it seems to make sense, but in my situation I need to send blank check-box values for records in a portal.

Just not sure where I put the item ( ) when the records are in the portal.

Love the technique otherwise, it's been a huge help!

Thanks,

Mike

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.