October 3, 201510 yr Hi, I was successful in creating records with drop down valuelists from my db, now I'd like an edit form on a new page to show those values and edit them. I only see the unedited drop down lists in the edit form. Here is some code: $layout =& $fm->getLayout('mylayout');$values = $layout->getValueList('statelist');$statelist = '<select name="State">';foreach ($values as $value) { $statelist .='<option value="' . $value . '">' . $value . '</option>'; }$statelist .= '</select>'; $edit = $fm->newEditCommand('mylayout', $_POST['id']); $edit->setField('State', $_POST['State']); $edit->execute(); $record = $fm->getRecordById('mylayout', $_GET['id']);$State = $record->getField('State'); <td><?php echo $statelist; ?></td> Thanks so much!
October 3, 201510 yr Can you give an example? Your code snippet doesn't really convey what you are trying to do
October 3, 201510 yr Author hi Doughemi, go to this link and click 'add name'. in the new pop up, add a name with some drop down values. dump that page and refresh the original page and click your persons first name. in the edit pop up, your value list items are reset to original settings, not showing the changes you made. http://ssvtennis.com/results.php?clubnumber=7061&Club=Paseo Club&clubtype=club here is my edit file, thanks! editnew.php
October 4, 201510 yr I can't see anything wrong with editnew.php on paper. At the beginning of your php code, put ini_set('display_errors', 1); error_reporting(E_ALL & ~E_DEPRECATED); You will need to put in some echo statements for troubleshooting to see if variables really got set correctly; e.g. echo '$variable = ' $variable; Also, you will need to put in some error checking after all your execute() statements to see why FM doesn't execute the setField() statements. $someVariable->execute(); if(FileMaker::isError($someVariable){ echo '<p>Error $someVariable: '. $someVariable->getCode() . ' ' . $someVariable->getMessage() . '</p>'; } Of course, these can be removed or commented out once you go live.
October 5, 201510 yr I get an error: Warning: implode(): Invalid arguments passed in /home/randyinla/public_html/editnew.php on line 76$statelist = implode("\r", $_GET['statelist']);Is this line necessary? Two this on the surface I that look suspect:1) The error line uses a GET var which should be in the URL somewhere. The Implode() function require the second parameter to be an array.2) This is in the section where all data is being extracted from a POST array.It seems like your form is out of scope to allow the to be re-generated after EDIT. I modified it, normalized indenting (for readability), and added some comments. Please take a look.Hope this helps! editnew_dwdc.php
October 7, 201510 yr Author Thanks DWdata, that worked great. I appreciate your time and effort writing code for this solution. Can I buy you a beer?! Thanks Doughemi for your help and pointing me in the right direction!
Create an account or sign in to comment