August 6, 200817 yr On my layout I have a field called ProblemList that is defined as a repeating field with up to 50 repetitions. In php I'm trying to insert a record into the table on this layout but I can't seem to do it if I include setting the ProblemList field with a repetition greater than 0. All of the "problems" I want to insert into the ProblemList field are stored in an array called $problems. I am looping through them and using the setField command to specify the repetition number. Here's my code: $counter = 0; foreach($problems as $problem) { $request->setField('ProblemList', $problem[1], $counter); $counter += 1; } On my layout, I have the ProblemList field set to an edit box, and I've hidden it by making the text the same color as the background. It works if I do the following: $request->setField('ProblemList', $problem[1], 0) But then of course it only stores one of them. When the counter is incremented, it stops working. Any ideas on this? Thank you! ~Joanna
August 6, 200817 yr You need all of the repetitions that you want to write to displayed on the layout. Also, it sounds like you are using the same layout for client access and API development. This is generally a bad idea that can lead to long page load times. You will be better off building API specific layouts that contain only the fields you wish to access via the API. I'm also assuming that your $problems array is an array of arrays and you always want to grab the second value. something like $problems = array(array("a","one"), array("b","two"), array("c","three")); where you want to write "one", "two", and "three" to the database.
Create an account or sign in to comment