Jump to content

Dave Carmean

Members
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Dave Carmean

  • Rank
    Filemaker Server/ PHP API

Profile Information

  • Gender
    Not Telling
  • Location
    Vancouver

Contact Methods

  • Website URL
    http://www.sfu.ca/biology2/staff/carmean/
  1. If you are using booleans, e.g. Yes/No, since 1. Code is processed sequentially 2. Only the last 'checked' answer is used. Therefore put the 'non' answer first but hide it and leave it always checked. The positive answer comes second. <?php $fieldName = 'Privacy_Agreement';?> <?php $fieldValue = $record->getField($fieldName, 0) ; ?> <input type='hidden' name='<?php echo (getFieldFormName($fieldName, 0, $record, true, 'EDITTEXT', 'number')) ;?>' value='No' checked> <input type='checkbox' name='<?php echo (getFieldFormName($fieldName, 0, $record, true, 'EDITTEXT', 'number')-1) ;?>' value='Yes' <?php if ($fieldValue == 'Yes'){ echo 'checked'; } ?>> You can insert whatever text before or after. This works for me- I was searching for how to make a single checkbox work.
  2. So simple that I completely missed the possibility. That is very, very convenient. I appreciate your help. Thank you for your time!
  3. I would like to edit a value list via a web interface- I have done this using a field ("Use values from field"), but that [I incorrectly assumed, see doughemi's suggestion below!] requires adding/editing a record for each value, while (if possible) the textarea box would allow the editing of the whole value list at once. Genx showed how to display a value list... $layout = $fm->getLayout('my_template'); $list = array_map("htmlentities",(array)$layout->getValueList('my_list')); I am hoping there is some easy way to send back an edited valuelist… We are using Filemaker Server 11 (not advanced). Thanks in advance!
  4. My question may be as simple as how do I enter a date in DD/MM/YYYY format using a radio button? (If you can answer that, ignore the rest). I have a simple form for online Timesheets that we have been using for years (thousands have been entered without almost no work on my part since I set it up). Now we want to change the date format from MM/DD/YYYY to DD/YY/YYYY. Everything works except where I auto-enter the "Period Ending" Date. An assistant updates the global value for the "Period Ending" Date in FileMaker every two weeks- this date needs to be auto-entered in new Timesheets (but must be modifiable by workers). Since addrecord.php is creating a new record I use a valuelist that finds that date [a related, global value] in a global table that consists of one record with various global values for the Timesheets table. <?php $fieldValue = "test " . $record->getField('Period Ending', 0) ; ?> <?php getInputChoices("radiobutton", $layout->getValueListTwoFields('Timesheet Period Ending Date', (isset($master_record)) ? $master_record->getRecordId() : $record->getRecordId()), $fieldValue, getFieldFormName('Period Ending', 0, $record, true, 'RADIOBUTTONS', 'text'), 'text', $submitDateOrder);?> is the ending date for the Current Pay Period.this appears as 2-Week Period Ending (MM/DD/YYYY): [Entry field with 07/04/2015 autoentered]07/04/2015 is the ending date for the Current Pay Period.And really works well (don't ask me about 'test ', it is ignored). To change the date format I tried doing a calculation [Day ( timesheets Period Ending global ) & "/" & Month ( timesheets Period Ending global ) & "/" & Year ( timesheets Period Ending global )] to change the order but it submits it in the MM/DD/YYYY format (other date fields ARE dealt with properly!!!). <?php $fieldValue = $record->getField('Period Ending', 0) ; ?> <?php getInputChoices("radiobutton", $layout->getValueListTwoFields('Timesheet Period Ending Date calc', (isset($master_record)) ? $master_record->getRecordId() : $record->getRecordId()), $fieldValue, getFieldFormName('Period Ending', 0, $record, true, 'RADIOBUTTONS', 'text'), 'text', $submitDateOrder);?> is the ending date for the Current Pay Period.2-Week Period Ending (DD/MM/YYYY): [Entry field with 04/07/2015 autoentered]04/07/2015 is the ending date for the Current Pay Period.This is entered as April, while in the other date fields in the same form 04/07/2015 is entered as July. I am doing this with Filemaker Server 11, using PHP/Apache on a mac mini client.
  5. Thank you Xochi! I followed the instructions in your link (apple stackexchange) for our Filemaker 11 server on mountain lion (client, not server). No problems. Update- I install the bash fix Friday night but did not restart the server until Monday morning. The bash fix does not require restarting the system, but the system logs will include some errors as the signature of the new bash does not correspond to the record until after a restart. And I always need to restart the web server [sudo apachectl graceful] after restarting the system.
  6. I have a single form that asks a person to answer questions (name etc) and upload a file to the server using <input name="PDFname" type="file" /> Works Beautifully- when the information and file are uploaded successfully the user gets the message echo ($file['name']. ' was successfully uploaded to the server' I don't know how to get the name of the uploaded file into Filemaker. Any suggestions are welcome! I think it should be simple. From my reading I think I have to join the information $_FILES['file']['name'] from the $_FILES array with this // get the submitted record data $recorddata = $cgi->get('recorddata'); if (isset ($recorddata)) { // submit the data to the db $result = submitRecordData($recorddata, $newrecordrequest, $cgi, $layout->listFields()); I looked at using @session_start(); hoping I could forward all the information, but I hope there is a more direct way (andI don't know if that will work). For security I only allow the web account to add new records, not view or edit. We are using Filemaker 10 server on Snow Leopard client (we have Filemaker 11 but not installed yet), and have using files heavily modified from the site assistant. This is the confirmation php file: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <?php /** * FileMaker PHP Site Assistant Generated File */ require_once 'fmview.php'; require_once 'FileMaker.php'; require_once 'error.php'; $cgi = new CGI(); $cgi->storeFile(); ... Database & password etc... $fm = & new FileMaker(); $fm->setProperty('database', $databaseName); $fm->setProperty('username', $userName); $fm->setProperty('password', $passWord); ExitOnError($fm); $layout = $fm->getLayout($layoutName); ExitOnError($layout); // formats for dates and times $displayDateFormat = '%m/%d/%Y'; $displayTimeFormat = '%I:%M:%S %P'; $displayDateTimeFormat = '%m/%d/%Y %I:%M:%S %P'; $submitDateOrder = 'mdy'; // create the new add command $newrecordrequest = $fm->newAddCommand($layoutName); ExitOnError($newrecordrequest); // get the submitted record data $recorddata = $cgi->get('recorddata'); if (isset ($recorddata)) { // submit the data to the db $result = submitRecordData($recorddata, $newrecordrequest, $cgi, $layout->listFields()); // clear the stored record data $cgi->clear('recorddata'); ExitOnError($result); if ($result->getFetchCount() > 0) { $records = $result->getRecords(); $record = $records[0]; } } ExitOnError($record); ?> <html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>Biological Sciences</title></head> <body> <?php $timestamp = time(); // begin Dave B's Q&D file upload security code http://php.net/manual/en/features.file-upload.php $allowedExtensions = array("pdf"); foreach ($_FILES as $file) { if ($file['tmp_name'] > '') { if (!in_array(end(explode(".", strtolower($file['name']))), $allowedExtensions)) { die('<b>' .$file['name'].' is not a PDF file</b>. <h2> <a href="index.php">Go back to the form</a> <h2> '); } } } // end Dave B's Q&D file upload security code $SafeFile = $_FILES['PDFname']['name']; // was $HTTP_POST_FILES $SafeFile = str_replace("#", "No", $SafeFile); $SafeFile = str_replace("$", "Dollar", $SafeFile); $SafeFile = str_replace("%", "Percent", $SafeFile); $SafeFile = str_replace("^", "-", $SafeFile); $SafeFile = str_replace("&", "and", $SafeFile); $SafeFile = str_replace("*", "1", $SafeFile); $SafeFile = str_replace("?", "2", $SafeFile); $SafeFile = str_replace(":", "3", $SafeFile); $uploaddir = 'tmp_applicant_uploads/'; $uploadfile = $uploaddir . $timestamp ."_" . $SafeFile ; echo '<div>'; if (move_uploaded_file($_FILES['PDFname']['tmp_name'], $uploadfile)) { echo ' <table cellpadding="0" cellspacing="0" class="contentbg"> <tr><td class="contentbgleft"> </td><td > <h1>Confirmation of Receipt of Your Application and file ' . $file['name'] . '</h1> <table cellpadding="1" cellspacing="0" class="recwidth"><tr><td valign="top"> '; echo ($file['name'].' was successfully uploaded <br/>'); // Read and write for owner, read for everybody else (not used here) // chmod($uploadfile, 0644); } else { echo "The file was not uploaded (but your information was processed!).\n"; } // echo '<br/><br/>Here is some more debugging info:'; // print_r($_FILES); print "</div>"; ?> and the form: <form enctype="multipart/form-data" action="confirmation_short.php" method="Post"> <input type="hidden" name="-db" value="<?php echo $databaseName ?>"> <input type="hidden" name="-lay" value="<?php echo $layoutName ?>"> <input type="hidden" name="-action" value="new"> <table cellpadding="1" cellspacing="6" class="record"> <tr><td align="right" valign="top"> Position: </td><td> <?php $fieldValue = $record->getField('position', 0) ; ?><?php getInputChoices("radio", $layout->getValueListTwoFields('position', (isset($master_record)) ? $master_record->getRecordId() : $record->getRecordId()), $fieldValue, getFieldFormName('position', 0, $record, true, 'RADIOBUTTONS', 'text'), 'text', $submitDateOrder);?></td> </tr> <tr onkeypress="return event.keyCode != 13;"> <td align="right">First Name:</td> <td><?php $fieldValue = $record->getField('First_Name', 0) ; ?><input type="text" size="30" maxlength="40" name= "<?php echo getFieldFormName('First_Name', 0, $record, true, 'EDITTEXT', 'text');?>" value="<?php echo $fieldValue;?>"> Last Name: <?php $fieldValue = $record->getField('Last_Name', 0) ; ?><input type="text" size="30" maxlength="40" name= "<?php echo getFieldFormName('Last_Name', 0, $record, true, 'EDITTEXT', 'text');?>" value="<?php echo $lastname;?>">&nbsp; </td> </tr> <tr><td colspan="2"> <div id="contenttitlebg"> <h1>Attach PDF</h1></div></td></tr> <tr onkeypress="return event.keyCode != 13;"> <td align="right"></td> <td><br> <!-- Name of input element determines name in $_FILES array --> <input name="PDFname" type="file" /></td></tr> <!--Display record form controls--><tr><td>&nbsp;</td><td> <input type="submit" class="buttons" name="-new" value="Submit Application"></td></tr> </table> </form>
  7. It actually works on the website to put <br /> and &nbsp; in the value list: Lecturer<br /> Instructor - BISC101 <br /> Instructor - BISC432 <br /> Instructor&nbsp;-&nbsp;BISC654 However, when the form is submitted, '<br />' is visible to people viewing the field with a Filemaker client (nbsp; is not, at least not visibly!). Any suggestions for cleaning up the submission, or a different coding character for a hard return- I tried other 'return' characters... Lecturer &#12; Instructor - BISC101&#10 Instructor - BISC432&#13; Instructor - BISC650 <br /> Instructor&nbsp;-&nbsp;BISC654 But none of these (except <br />) worked.
  8. On a web entry form with radio buttons using a valuelist, some of the choices have the radio button on the far right of the line above the wording of the choice, making that choice confusing. Is there a way to force each value to have a new line? (Or enforce orphan protection, so at least each choice has a couple of words next to the radio button?) Here is an example where there is a button for BISC650 next to BISC432 text: Here is the current code (Valuelist and field are both called 'position'): <?php $fieldValue = $record->getField('position', 0) ; ?><?php getInputChoices("radio", $layout->getValueListTwoFields('position', (isset($master_record)) ? $master_record->getRecordId() : $record->getRecordId()), $fieldValue, getFieldFormName('position', 0, $record, true, 'RADIOBUTTONS', 'text'), 'text', $submitDateOrder);?> I tried using a hyphen in the value list, but that showed as a choice (rather than a new line as in a Filemaker client). We are using Filemaker 10 server. Thanks for any suggestions!
  9. This may be clunky, but it appears to work. Suggestions for improving it are welcome. <?php if (nl2br( $record->getField('Instructor website', 0) ) != "" ) { echo " href="" . nl2br( $record->getField('Instructor website', 0) ) . "">" . nl2br( $record->getField('Instructor', 0) ) . "" ; } elseif (nl2br( $record->getField('Instructor email', 0) ) == "" ) { echo nl2br( $record->getField('Instructor', 0) ) ; } else { echo " href="mailto:" . nl2br( $record->getField('Instructor email', 0) ) . "">" . nl2br( $record->getField('Instructor', 0) ) . "" ; } ?>
  10. Filemaker PHP site assistant generates recordlist.php ... <?php echo getSortRecordsLink('Name', 'Name')?> <?php echo getSortRecordsLink('Website', 'Website')?> <?php echo getSortRecordsLink('Email', 'Email')?> I want a single column with the name linked to the website, but if no website exists, linked to the email, and if no email, just the name. The old CDML code was- [FMP-IF: field:Website.cn.http] [FMP-FIELD: Name][FMP-ELSE][FMP-IF: field:Email.cn.@] [FMP-FIELD: Name][FMP-ELSE][FMP-FIELD: Name][/FMP-IF][/FMP-IF] Does anyone have suggestions or a sample php file that does something like this? I don't want to use calculations within Filemaker. Thanks for any help.
  11. I got the message 'invalid user name or password. Please try again.' when trying to authenticate. While the user had '[Full Access]' listed under privilege set, it turned out I had not checked off 'Access via PHP Web Publishing' in the extended privileges. Check that area to see if it fixes the authentication problem.
  12. I got the message 'invalid user name or password. Please try again.' when trying to authenticate via website I had set up- while the user had '[Full Access]' as listed under privilege set, it turned out I had not checked off 'Access via PHP Web Publishing' in the extended privileges. Security is good, but the error message could be improved!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.