Jump to content

Gainax

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

Everything posted by Gainax

  1. Ok I now have this: $to = 'me@example.com'; $subject = "Form Submit"; $headers .= "From: Website <me@example.com>\r\n"; $headers .= "To: me2@example.com\r\n"; $headers .= "Cc: clients1@example.co.uk\r\n"; $headers .= "Bcc: client2@example.com\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; if (mail($to, $subject, $message, $headers)) { header('Location: thankyou.php'); } else { echo("<p>Message delivery failed...</p>"); } Does this look ok?
  2. Ok I have the following code now, and only I can get the emails: $to = 'client1@example.co.uk,client2@example.co.uk,me@example.com'; $subject = "Form Submit"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "To: Client1 <client1@example.co.uk>,Client2 <client2@example.co.uk>,Me <me@example.com>\r\n"; $headers .= "From: Website <website@example.co.uk>\r\n"; $to = explode(',',$to); foreach($to as $recipient) { if (mail($recipient, $subject, $message, $headers)) { header('Location: thankyou.php'); } else { echo("<p>Message delivery failed...</p>"); } } I get the emails fine. But the other 2 email addresses don not receive anything. Is there anything wrong with my code? Thanks
  3. Ok thanks. I'll see If those who should get the emails do in fact get them Thanks
  4. My code is : $to = 'jim@example.com, bob@example.com, ted@example.com'; $subject = "New Applicants submit"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "To: Ted <ted@example.com>, bob <bob@example.com>, jim <jim@example.com>\r\n"; $headers .= "From: Website <website@example.com>\r\n"; $to = explode(',',$to); foreach($to as $recipient) { mail($recipient,$subject,$msg,$headers); } Should this work?
  5. What about the headers? The email gets sent as HTML. Can I still have the $headers in the mail()?
  6. Will I still have the following code? $to = "bob@example.com, ted@example.com, jim@example.com";
  7. So something along the lines of: $to = "bob@example.com"; $subject = "New Applicants submit"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; /* headers adicionais */ $headers .= "From: Web <website@example.com>\r\n"; $headers . = "Cc: jim <jim@example.com>, ted <ted@example.com>"; mail($to, $subject, $msg, $headers);
  8. $to = "bob@example.com, ted@example.com, jim@example.com"; Will this do?
  9. Hi I have a form which sends out an email. I'm trying to send it to muliple people. The following is my code: $to = "bob@example.com"; $subject = "New Applicants submit"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; /* headers adicionais */ $headers .= "To: Jim <jim@example.com>, Ted <ted@example.com>\r\n"; $headers .= "From: Web <website@example.com>\r\n"; mail($to, $subject, $msg, $headers); This all works fine when I put the email addresses of some of my colleagues (using Gmail). But If I try putting any other email, those who use Outlook, no-one receives the emails. Is there anything wrong with my form?
  10. I had the following code: $body = "Name: " . $name . "\n\n" . "Address: " .trim($address); and then tried: $body = "Name: " . $name . "\n\n" . "Address: " .nl2br($address);
  11. function validateAddress($address){ //if it's NOT valid if(strlen($address) < 4) return false; //if it's valid else return true; }
  12. I tried that too, and it didn't work
  13. I have a form, which takes the input and when submitted it sends an email to me with the content. One field is a textarea and when I get the email I get \r\n where someone has gone onto a newline in the text area. My form is: <form id="requestform" name="requestform" method="post" action=""> <p><label for="name">Name:*</label><br /> <?php echo (($nameOK) ? "" : "<p style=\"color:red;\"><strong>Invalid Name: </strong> Your name must be at least 3 letters<br /></p>"); ?> <input name="name" class="text" type="text" id="name" value="<?=$_POST['name'] ?>" /></p> <p><label for="address">Address:*</label><br /> <?php echo (($addressOK) ? "" : "<p style=\"color:red;\"><strong>Invalid Address: </strong> Please enter your full address<br /></p>"); ?> <textarea name="address" class="text" name="address" cols="30" rows="5" value="<?=$_POST['address'] ?>" ></textarea><br /></p> <button type="submit" name="send" value="send" style="height: 26px; width: 96px; border: 0px;" ><img src="images/send_request.jpg" alt="send" title="" /></button> And the code which takes the form data is: <?php if( isset($_POST['send'])) { $nameOK = validateName($_POST['name']); $addressOK = validateAddress($_POST['address']); if ($nameOK && $addressOK ) { $to = "example@example.com"; $subject = "Request"; $body = "Name: " . $name . "\n\n" . "Address: " .$address; $headers = 'From: example@example.co.uk' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if (mail($to, $subject, $body, $headers)) { header('Location: thankyou.php'); } else { I've tried using nl2br around the $address variable, but I still get the \r\n after each linebreak Am I doing anything wrong? Thanks
  14. I have 3 classes in mycode, which uses a background image in the CSS. (3 classes, 3 diff images) I want the image to act as a link. My code is as follows: <h2 class="dashboard-facilities-header">Facilities</h2> <div> <p class="dashboard-desc">Here you can add/edit your profile that everyone can see!</p> </div> </div> <div class="user-dashboard-boxes"> <h2 class="dashboard-teams-header">Teams & Clubs</h2> <div> <p class="dashboard-desc">Here you can add/edit your profile that everyone can see!</p> </div> </div> <div class="user-dashboard-boxes"> <h2 class="dashboard-events-header">Events</h2> <div> <p class="dashboard-desc">Here you can add/edit your profile that everyone can see!</p> </div> </div> h2.dashboard-facilities-header {background-image:url(../images/dashboard-facilities-header.png);background-repeat:no-repeat;height:25px;text-indent:-9999px;} h2.dashboard-teams-header {background-image:url(../images/dashboard-teams-header.png);background-repeat:no-repeat;height:25px;text-indent:-9999px;} h2.dashboard-events-header {background-image:url(../images/dashboard-events-header.png);background-repeat:no-repeat;height:25px;text-indent:-9999px;} All help is welcome
  15. That works great! The only thing I need to do now, is before the redirect insert the values into a db Any ideas about this?
  16. Ok, so how will I modify my script to have this redirect once validation is completed?
  17. Ok, so I found a tutorial I have the following code: <div class="enquiry-form-obligation"> <?if( isset($_POST['send']) && (!validateName($_POST['name']) || !validateAddress($_POST['address']) || !validateEmail($_POST['email']) || !validateTelephone($_POST['telephone']) || !validateIncome($_POST['income']) ) ):?> <div id="error"> <ul> <?if(!validateName($_POST['name'])):?> <li><strong>Invalid Name:</strong>Your name must be at leasr 3 letters</li> <?endif?> <?if(!validateAddress($_POST['address'])):?> <li><strong>Invalid Address:</strong> Please enter your full address</li> <?endif?> <?if(!validateEmail($_POST['email'])):?> <li><strong>Ivalid email:</strong> Please enter a valid email address</li> <?endif?> <?if(!validateTelephone($_POST['telephone'])):?> <li><strong>Invalid number:</strong> You number must be at least 11 numbers</li> <?endif?> <?if(!validateIncome($_POST['income'])):?> <li><strong>Invalid income:</strong> Please enter your monthly income</li> <?endif?> </ul> </div> <?elseif(isset($_POST['send'])):?> <div id="error" class="valid"> <ul> <?php header('Location: thankyou.html'); ?> </ul> </div> <?endif?> <form action="" id="contactform" name="contactform" method="post" action=""> <label for="name">Name:*</label><br /> <input name="name" class="text" type="text" id="name" value="<?=$_POST['name'] ?>" /><br /> <label for="company">Company Name (if applicable)</label><br /> <input name="company" class="text" type="text" value="<?=$_POST['company'] ?>" /><br /> <label for="address">Address:*</label><br /> <textarea name="address" class="text" name="address" cols="30" rows="5" value="<?=$_POST['address'] ?>" ></textarea><br /><br /> <label for="postcode">Postcode:</label><br /> <input name="postcode" class="text" type="text" value="<?=$_POST['postcode'] ?>"/><br /> <label for="email">Email:*</label><br /> <input name="email" class="text" type="text" value="<?=$_POST['email'] ?>" /><br /> <label for="telephone">Tel:*</label><br /> <input name="telephone" class="text" type="text" value="<?=$_POST['telephone'] ?>" /><br /><br /> <p><strong>Your Status</strong></p><br /> <input type="radio" name="status" value="ltd"> <label for="postcode">Ltd company:</label><br /> <input type="radio" name="status" value="sole"> <label for="postcode">Sole Trader:</label><br /> <input type="radio" name="status" value="partnership"> <label for="postcode">Partnership:</label><br /> <input type="radio" name="status" value="individual"> <label for="postcode">Individual:</label><br /><br /> <p><strong>About your Liabilities</strong></p> <div style="width: 780px; height: 150px; "> <div style="width: 280px; float: left;"> <label for="credit1">Name of Creditor:</label><br /> <textarea name="credit1" class="text" name="credit1" cols="30" rows="5" style="float: left;" value="<?=$_POST['credit1'] ?>"></textarea><br /><br /> </div> <label for="owings">Total Amount Owings &#163;'s:</label><br /> <textarea name="owings" class="text" name="owings" cols="30" rows="5" style="float: left;" value="<?=$_POST['owings'] ?>" ></textarea><br /><br /> </div> <p><strong>About your Assets </strong></p> <div style="width: 880px; height: 150px; "> <div style="width: 280px; float: left;"> <label for="credit2">Name of Creditor:</label><br /> <textarea name="credit2" class="text" name="credit2" cols="30" rows="5" style="float: left;" value="<?=$_POST['credit2'] ?>"></textarea><br /><br /> </div> <div style="width: 280px; float: left;"> <label for="valuation">Current Valuation:</label><br /> <textarea name="valuation" class="text" name="valuation" cols="30" rows="5" style="float: left;" value="<?=$_POST['valuation'] ?>"></textarea><br /><br /> </div> <div style="width: 280px; float: left;"> <label for="finance">Outstanding Finance:</label><br /> <textarea name="finance" class="text" name="finance" cols="30" rows="5" style="float: left;" value="<?=$_POST['finace'] ?>"></textarea><br /><br /> </div> </div> <label for="income">Monthly Income:*</label><br /> <input name="income" class="text" type="text" value="<?=$_POST['income'] ?>" /><br /><br /> <p class="form-small-text">* denotes mandatory fields </p> <input id="send" name="send" type="submit" value="Send" /> </form> <p> </p> </div> You can see, I want it to redirect to the thank you page when all the fields are filled out correctly. But I get the following error: Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\CRAIG\frazer\obligation_review.php:9) in C:\xampp\htdocs\CRAIG\frazer\obligation_review.php on line 152 Any ideas how to get around this? When all the fields
  18. Where will my form go in that code xcoderx? Thanks
  19. <div class="enquiry-form"> <h1>Enquiry Form</h1> <p> </p> <form action="contact_process.php" id="contactform" name="contactform" method="post" action=""> <label for="title">Title:*</label><br /> <input name="title" class="text" type="text" /><br /> <label for="firstname">First Name:*</label><br /> <input name="firstname" class="text" type="text" /><br /> <label for="comments">Title:</label><br /> <textarea name="comments" class="text" name="comments" cols="30" rows="5"></textarea><br /><br /> <p class="form-small-text">* denotes mandatory fields </p> <input id="time-input" type="image" src="images/send_request.jpg" alt="" title="" /> </form> <p> </p> </div>
  20. Hi I have a form with 3 input fileds. I want to have them all be made mandatory. So If someone submits the form, if the fields are empty display an error. I want each error to display underneath the input field. How do I do this? Thanks
  21. Hi I've got Gallery2 installed http://gallery.menalto.com/ and I can't seem to upload images. I try to upload a thumbnail and I get the following error message: An error has occurred while interacting with the platform. The exact nature of the platform error is unknown. A common cause are insufficient file system permissions. This can happen if you or your webhost changed something in the file system, e.g. by restoring data from a backup. Back to the Gallery Error Detail - Error (ERROR_PLATFORM_FAILURE) * in modules/thumbnail/classes/ThumbnailImage.class at line 213 (GalleryCoreApi::error) * in modules/thumbnail/classes/ThumbnailHelper.class at line 242 (ThumbnailImage::create) * in modules/thumbnail/CustomThumbnailOption.inc at line 90 (ThumbnailHelper::addItem) * in modules/core/ItemEdit.inc at line 109 (CustomThumbnailOption::handleRequestAfterEdit) * in main.php at line 231 (ItemEditController::handleRequest) * in main.php at line 94 * in main.php at line 83 System Information Gallery version 2.2.3 PHP version 5.2.5 apache2handler Webserver Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.7a DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 SVN/1.1.4 PHP/5.2.5 Database mysqli 4.1.22-standard Toolkits Thumbnail, SquareThumb, Gd Operating system Linux server.teabaghosting.com 2.6.9-023stab046.2-smp #1 SMP Mon Dec 10 15:04:55 MSK 2007 x86_64 Browser Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729) Also, whenever I create an ablum, it seems to create it with the wrong ownsership. Further more, I cannot delete an album either. Thanks
  22. Hi all I've just installed ubuntu jaunty on a old pc I had, but I cannot access the internet using it. I've plugged a network cable form my router to the pc, but I get nothing. I can access it via other machines, so I know it's on my network. The only problem is that it can't seem to get past the internal network to the internet. Any ideas? Thank you
  23. Gainax

    Symfony woes

    Hi I've built a form in symfony which is fine in terms of the way it looks. The only problem is I can't submit it as I'm getting an error. The form takes the persons user_id when they are logged in and a few other fields which are simply text/input boxes. As the form is to post jobs, I thought it would be wise to have a job id, to make things easier and to keep jobs in a formatted way in the db. The only problem is, the id column is giving me the error. The error is its passing in an invalid id. My code for the BaseJobForm class which does the validation is: <?php /** * Job form base class. * * @package fitbritz * @subpackage form * @author mysyfy@gmail.com * @version SVN: $Id: sfPropelFormGeneratedTemplate.php 16976 2009-04-04 12:47:44Z fabien $ */ class BaseJobForm extends BaseFormPropel { public function setup() { $this->setWidgets(array( 'id' => new sfWidgetFormInputHidden(), 'title' => new sfWidgetFormInput(), 'user_id' => new sfWidgetFormInputHidden(), 'job_category_id' => new sfWidgetFormPropelChoice(array('model' => 'JobCategory', 'add_empty' => true)), 'created_at' => new sfWidgetFormDateTime(), 'updated_at' => new sfWidgetFormDateTime(), 'salary' => new sfWidgetFormInput(), 'availability' => new sfWidgetFormInput(), 'country_id' => new sfWidgetFormPropelChoice(array('model' => 'Country', 'add_empty' => true)), 'region_id' => new sfWidgetFormPropelChoice(array('model' => 'Region', 'add_empty' => true)), 'district_id' => new sfWidgetFormPropelChoice(array('model' => 'District', 'add_empty' => true)), 'city_id' => new sfWidgetFormPropelChoice(array('model' => 'City', 'add_empty' => true)), 'is_active' => new sfWidgetFormInput(), 'description' => new sfWidgetFormTextarea(), 'duties' => new sfWidgetFormTextarea(), 'candidate_info' => new sfWidgetFormTextarea(), 'benefits' => new sfWidgetFormTextarea(), 'skills' => new sfWidgetFormTextarea(), 'how_apply' => new sfWidgetFormTextarea(), )); $this->setValidators(array( 'id' => new sfValidatorPropelChoice(array('model' => 'Job', 'column' => 'id', 'required' => true)), 'title' => new sfValidatorString(array('max_length' => 255)), 'user_id' => new sfValidatorPropelChoice(array('model' => 'sfGuardUser', 'column' => 'id', 'required' => false)), 'job_category_id' => new sfValidatorPropelChoice(array('model' => 'JobCategory', 'column' => 'id', 'required' => false)), 'created_at' => new sfValidatorDateTime(array('required' => false)), 'updated_at' => new sfValidatorDateTime(array('required' => false)), 'salary' => new sfValidatorString(array('max_length' => 255)), 'availability' => new sfValidatorString(array('max_length' => 255)), 'country_id' => new sfValidatorPropelChoice(array('model' => 'Country', 'column' => 'id', 'required' => false)), 'region_id' => new sfValidatorPropelChoice(array('model' => 'Region', 'column' => 'id', 'required' => false)), 'district_id' => new sfValidatorPropelChoice(array('model' => 'District', 'column' => 'id', 'required' => false)), 'city_id' => new sfValidatorPropelChoice(array('model' => 'City', 'column' => 'id', 'required' => false)), 'is_active' => new sfValidatorInteger(array('required' => false)), 'description' => new sfValidatorString(), 'duties' => new sfValidatorString(), 'candidate_info' => new sfValidatorString(), 'benefits' => new sfValidatorString(), 'skills' => new sfValidatorString(), 'how_apply' => new sfValidatorString(), )); $this->widgetSchema->setNameFormat('job[%s]'); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); parent::setup(); } public function getModelName() { return 'Job'; } } Any my form is: <?php use_helper('Form','I18N')?> <div id="left-col"> <?php echo include_partial('team/left_col_box') ?> <?php echo include_partial('career/left_col_box')?> <?php echo include_partial('advice/left_col_box') ?> <?php echo include_partial('opportunity/left_col_box') ?> </div> <style type="text/css"> </style> <div class="page"> <?php echo include_partial('members/main_menu'); ?> <h3 class="sub"><?php echo link_to('Return to list','members_job') ?> <?php echo $form->getObject()->getTitle() ?></h3> <?php if($sf_user->hasFlash('notice')): ?> <div class="message-success"> <p><?php echo $sf_user->getFlash('notice'); ?></p> </div> <?php endif; ?> <?php if ($sf_user->hasFlash('error')): ?> <div class="message-fail"> <p><?php echo __($sf_user->getFlash('error'), array(), 'sf_admin') ?></p> </div> <?php endif; ?> <?php if($form->hasErrors()): ?> <?php foreach($form->getErrorSchema()->getErrors() as $name=>$error): ?> <div class="message-fail"> <p><?php echo $name . '=='.$error; ?></p> </div> <?php endforeach; ?> <?php endif; ?> <div> <?php echo form_tag_for($form, '@members_job',array('class'=>'ryform')) ?> <?php echo $form->renderHiddenFields(); ?> <fieldset> <legend><strong>Main Job Details</strong></legend> <ul> <?php echo $form['title']->renderRow() ?> <?php echo $form['salary']->renderRow() ?> <?php echo $form['availability']->renderRow() ?> <?php echo $form['job_category_id']->renderRow() ?> <?php echo $form['country_id']->renderRow() ?> <?php echo $form['region_id']->renderRow() ?> <?php echo $form['district_id']->renderRow() ?> <?php echo $form['city_id']->renderRow() ?> </ul> </fieldset> <fieldset> <legend><strong>Texts</strong></legend> <ul> <?php echo $form['description']->renderRow(array('class'=>'tinyMCE')) ?> <?php echo $form['duties']->renderRow(array('class'=>'tinyMCE')) ?> <?php echo $form['candidate_info']->renderRow(array('class'=>'tinyMCE')) ?> <?php echo $form['skills']->renderRow(array('class'=>'tinyMCE')) ?> <?php echo $form['benefits']->renderRow(array('class'=>'tinyMCE')) ?> <?php echo $form['how_apply']->renderRow(array('class'=>'tinyMCE')) ?> </ul> </fieldset> <input type="submit" value="save" /> </form> </div> </div> <?php echo include_partial('sidebars/ads') ?> In the schema.xml file, the id column for job table is: <column name="id" type="INTEGER" size="11" primaryKey="true" autoIncrement="true" required="true" /> Looking at the form in FF web dev tools, the job id is 3 and the user_id is 3 (3 = my user id in the user_profile table), but it's saying that 3 is invalid. Can anyone suggest reasons why it's doing this?
  24. Hi I have created a drag and drop application whereby users who view it are able to drag and drop a series of rows, edit them and then click 'save' which saves the row information to a txt file. What I'm looking to do is, make it so that everytime a user drags and drops a particular row, the information is saved dynamically, possibly to a database, rather than a txt file, without the need to click on the save button. As the application is a table, with 5 columns, the final column, is to be a number (from 1 > n). What I'm looking to do is, when a user drags, lets say row 1 and drops it to replace row 3, I want to dynamically update the numbers. Example A - B - C - 1 D - E - F - 2 G - H - I -3 So when row one is moved, currently on my version it reads: D - E - F - 2 G - H - I -3 A - B - C - 1 What i want it to read is: D - E - F - 1 G - H - I -2 A - B - C - 3 My code is as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>ABA Priority List</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <script type="text/javascript" src="js/sort.js"> </script> <link rel="stylesheet" type="text/css" href="styles/styles.css" /> <script type="text/javascript"> //------------------------------ //Custom Info var colNames=new Array ( "Briefed by:", "DIGITAL", "Needed by:", "STATUS", "PRIORITY" ); var defaultCellText="-"; //-------------------------------- //-------------------------------- var sortObj=null; window.addEvent("domready",function() { sortObj=new Sortables($('TableList')); $("AddButton").addEvent("click",function() { addRow(); }); $("SaveButton").addEvent("click",function() { save(); }); $("SortRadio").addEvent("click",function() { sortMode(); }); $("EditRadio").addEvent("click",function() { editMode(); }); $("RevertButton").addEvent("click",function(){ revert(); }); $$("#Controls form")[0].reset(); if(!window.ie) $("TableList").setStyle("margin-left","110px"); getDataFromServer(); }); function getRow(datArray) { var info=new Array(defaultCellText,defaultCellText,defaultCellText,defaultCellText,defaultCellText); if(typeof datArray !== "undefined") { info=datArray; } var row=maker("li").addClass("rowItem unsaved"); row.appendChild(maker("p").addClass("cellP close").setHTML('<img src="images/close.png" class="x" alt="[x]" />').addEvent("click",function() { this.parentNode.remove(); } ) ); for(var i=0;i<5;i++){ row.appendChild(maker("p").addClass("cellP col"+(i+1)).setHTML('<input type="text" value="'+info[i]+'" />')); } return row; } function addRow(datArray) { $("TableList").appendChild(getRow(datArray)); sortObj.detach(); sortObj=null; sortObj=new Sortables($('TableList')); $$(".rowItem .close .x").setStyle("display","inline"); $("SortRadio").click(); } function maker(tag){ return $(document.createElement(tag)); } function save() { var args=getDataFromForm(); var myAjax = new Ajax("data/save.php", { data: "data="+args, method: 'post', onRequest:function(){ $("Status").setHTML("<span>Saving</span>"); }, onComplete:function(response) { alert(response); if(response=="Data saved") { var d=new Date(); $("Status").setText("Last save: "+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds()); $$("#TableList .rowItem").removeClass("unsaved"); $$("#TableList .rowItem").addClass("saved"); } } } ); myAjax.request(); } function editMode() { sortObj.detach(); $$(".rowItem .close .x").setStyle("display","inline"); $$("#TableList input").setStyle("background","white"); } function sortMode() { sortObj.attach(); $$(".rowItem .close .x").setStyle("display","none"); $$("#TableList input").setStyle("background","transparent"); } function revert() { if(!confirm("Are you sure you want to revert to the last saved state?")) return; getDataFromServer(); } function getDataFromServer(){ var myAjax = new Ajax("data/load.php", { method: 'get', onRequest:function() { $("Status").setHTML("<span>Loading</span>"); }, onComplete:function(response) { var data=eval(response); if(typeof response.length !=="undefined") { $("TableList").setHTML(''); for(var i=0;i<data.length;i++) { addRow(data[i]); } $("Status").setText(""); $$("#TableList .rowItem").removeClass("unsaved"); $$("#TableList .rowItem").addClass("saved"); } } } ); myAjax.request(); } function getDataFromForm() { var rows=$$("#TableList li"); var str=""; for(var i=0;i<rows.length;i++) { var cols=rows[i].getElements("input"); var colstr=""; for(var j=0;j<cols.length;j++) { if(j!=0) colstr+=','; colstr+='"'+encodeURIComponent(hEsc(cols[j].value))+'"'; } str+=colstr+"\n"; } return str; } function hEsc(str) { var targ=str; targ=targ.replace(/'/g,"&#39;"); targ=targ.replace(/"/g,"""); targ=targ.replace(/</g,"<"); targ=targ.replace(/</g,">"); return targ; } </script> </head> <body> <div id="wrapper"> <h1>ABA Priority List - <?php echo date('l jS F Y'); ?></h1> <div id="DataDiv"> <div id="OuterControls"> <div id="Controls"> <input type="image" src="images/button.jpg" name="AddRow" width="90" height="22" id="AddButton" value="AddRow" STYLE="margin: 5px;"> <form onsubmit="return false" method="post" action="#"> <p> <input type="radio" id="SortRadio" value="sort" name="mode" checked="checked" STYLE="margin-left: 5px; "/> Sort mode </p> <p> <input type="radio" id="EditRadio" value="sort" name="mode" STYLE="margin-left: 5px; " /> Edit mode </p> </form> <input type="image" src="images/save.jpg" name="SaveButton" width="41" height="17" id="SaveButton" value="SaveButton" STYLE="margin-left: 3px; margin-top: 5px;float: left;"> <input type="image" src="images/revert.jpg" name="Revertbutton" width="49" height="17" id="RevertButton" value="RevertButton" STYLE="margin-left: 1px; margin-right: 3px; margin-top: 5px; float: right;"> <br /><br /> <p class="saved2"> <span class="inside">Saved</span> </p> <p class="unsaved2"> <span class="inside">Unsaved</span> </p> <p id="Status"> </p> </div> </div> <li class="rowItem header"> <p class="cellP close"></p> <p class="cellP col1"><script>document.write(colNames[0])</script></p> <p class="cellP col2"><script>document.write(colNames[1])</script></p> <p class="cellP col3"><script>document.write(colNames[2])</script></p> <p class="cellP col4"><script>document.write(colNames[3])</script></p> <p class="cellP col5"><script>document.write(colNames[4])</script></p> </li> <ul id="TableList"> <span>Loading saved data</span> </ul> </div> </div> </body> </html>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.