4 Replies Latest reply on Feb 13, 2016 2:38 PM by XsTatiC

    CWP - Field requires a valid value

    XsTatiC

      S.O.S.

      S.O.S.

       

      Please help.  I'm seriously going to end up in the looney bin.

       

      Just upgraded from FM 11 to 14.  All smooth except for the bits that we have connecting our website to FileMaker.  We've been using FX for ages, just because I inherited it and it worked.  Now it doesn't so I'm trying to convert to the proper FM API.

       

      Things look straightforward as far as the PHP API goes.  However I can't create a new record from PHP no matter what I try.  I can get any information I want or have permissions to from the database.  I can find and do everything else that needs to be done.  However, no matter what I try I just keep getting the same error when trying to enter a new record.

       

      "Field requires a valid value"

       

      I'm now trying to test this on a custom layout with a single field.  And I still get the error.  It doesn't seem to matter if I use newAddCommand or createRecord, same result.

       

      $fm = new FileMaker("database.fmp12", "xxx.xxx.xxx.xxx.", "user", "pass");

       

      $create = $fm->createRecord('new_layout');

      $create->setField('firstname', 'Somebody');

      $result = $create->commit();

       

      if(FileMaker::isError($result)){

          echo($result->getMessage());

          return;

      }

       

      "Field requires a valid value"

       

      $fm = new FileMaker("database.fmp12", "xxx.xxx.xxx.xxx.", "user", "pass");

      $create = $fm->newAddCommand('new_layout');

      $create->setField('firstname', 'Somebody');

      $result = $create->execute();

       

      returns - "Field requires a valid value"

       

      $fm = new FileMaker("database.fmp12", "xxx.xxx.xxx.xxx.", "user", "pass");

      $fmData = array('firstname'=>'Somebody');

      $create =& $fm->newAddCommand('new_layout', $fmData);

      $result = $createt->execute();

       

      returns - "Field requires a valid value"

       

      firstname field was indexed and required value/not empty.  I removed all of that to try and get this to work from PHP, but I don't actually want it removed.

       

      Server is OS X 10.11.3, FM Server 14.04 (whatever the latest is)... both OS and FM were freshly installed, updated to latest yesterday.

       

      Does anybody have any ideas?  Any thoughts that could point me in the right direction?  Help is most desperately needed at this point.

       

      My sanity and I appreciate your time.

       

      Cheers,

       

      Gerry

        • 1. Re: CWP - Field requires a valid value
          databuzz

          Hi Gerry,

           

          Are there any other fields in that table that require a value or have some kind of validation set at the field level?

           

          If you use FileMaker Pro to open the file, navigate to the same layout, create a new record and enter a value into the first name field do you get any other warnings when you commit the record?

          1 of 1 people found this helpful
          • 2. Re: CWP - Field requires a valid value
            mikebeargie

            Have you checked your database to see what field(s) in that table is require a value and are validated?

             

            Chances are it's something that 11 or fx.php overlooked and the API does not. You ARE making the right choice by dropping fx.php though!

             

            Make sure that all of the fields that are validated in your "new_layout" table have a custom dialog on failure, I don't remember, but I thought that custom error message is passed back if validation fails. That could assist you in troubleshooting.

             

            It doesn't matter if your layout only has one field, when your schema dictates that a field requires a valid value, then you will still see an error regardless of if the field is on your layout.

            1 of 1 people found this helpful
            • 3. Re: CWP - Field requires a valid value
              XsTatiC

              Thank you both for your replies.

               

              There are other fields in the Table that require validation. Non empty. The layout only has the single field... 

               

              Ohhhh... hey now!  That's behavior that I didn't expect.  Yes indeedy, even though my layout has a single field, firstname, when I open up the client and add a new record, I do indeed get an error about secondname, which has the same non-empty validation.

               

              Okay... I need to do 10 minutes of work now and a bit of testing.

               

              Will be back.

               

              Thank you so much.  A kick in the right direction may have been exactly what I needed to see progress.  Progress is much less demoralizing that hours and hours of no progress.

               

              Much appreciated!  I will update in the near future.

              • 4. Re: CWP - Field requires a valid value
                XsTatiC

                Facepalm.

                 

                Things are now working.  As both of you quite rightly pointed out, another field which requires validation (which I thought was moot because of a test layout that I was using which only had a single field) was the culprit.

                 

                pfbrbtbt.  relief.

                 

                Much appreciated.  Thank you very much.

                 

                Cheers,

                 

                Gerry