Jump to content

Setting the value of a Page field with the API when the value contains a comma


thetuningspoon
 Share

Recommended Posts

I am trying to set a page field via the api using a string match, like so:

$p->of(false);
$p->company_select = 'My Company Name, Inc.';
$p->save();

This works fine for companies that do not contain a comma, but for those with a comma, no value is set. I'm wondering if ProcessWire is trying to split this into two different values and find a match for each separately? Is there some way I can escape the comma?

Link to comment
Share on other sites

I figured it out. The problem was that I didn't have a Title field for the page I was trying to reference. So how it was working at all, I don't know. I'm now using the Title field to store the company name instead of a separate company_name field. No issues with commas or periods.

  • Like 2
Link to comment
Share on other sites

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...