close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

datepicker format

Thread began 12/21/2010 3:55 pm by CraigR | Last modified 11/16/2011 11:51 am by CraigR | 6033 views | 29 replies

John LangerBeta Tester

OK, I've got this working in as much as on picking the date the date is entered into the database all correctly. However I'm having a problem with the update page as if I change other details on the page but NOT the date (I leave this as displayed (2011-08-15) on updating the record it enters "0000-00-00". If I chosse the same date again via the date picker it all works fine. Any ideas? My code is below.

php:
<?php 
function i8_formatUKDateMySQL($date) {
$d str_replace(" ","",$date);
$d explode('/'$date);
$d $d[2].'-'.$d[1].'-'.$d[0];
return 
$d;
}  
?>
<?php 
// WA Application Builder Update
if (isset($_POST["Update_x"])) // Trigger
{
  
$WA_connection $connWatc;
  
$WA_table "tenders";
  
$WA_redirectURL "tenders_Detail.php?tenderID=".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"")  ."";
  if (
function_exists("rel2abs")) $WA_redirectURL $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
  
$WA_keepQueryString false;
  
$WA_indexField "tenderID";
  
$WA_fieldNamesStr "TitleOfTender|TenderDetails|ClosingDate|Attachment1|Attachment2";
  
$WA_fieldValuesStr "".((isset($_POST["TitleOfTender"]))?$_POST["TitleOfTender"]:"")  ."" "|" "".((isset($_POST["TenderDetails"]))?$_POST["TenderDetails"]:"")  ."" "|" "".((isset($_POST["ClosingDate"]))?i8_formatUKDateMySQL($_POST["ClosingDate"]):"")  ."" "|" "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"]  ."" "|" "".$WA_DFP_UploadStatus["WA_UploadResult2"]["serverFileName"]  ."";
  
$WA_columnTypesStr "',none,''|',none,''|',none,NULL|',none,''|',none,''";
  
$WA_comparisonStr "=|=|=|=|=";
  
$WA_fieldNames explode("|"$WA_fieldNamesStr);
  
$WA_fieldValues explode("|"$WA_fieldValuesStr);
  
$WA_columns explode("|"$WA_columnTypesStr);
  
  
$WA_where_fieldValuesStr "".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"")  ."";
  
$WA_where_columnTypesStr "none,none,NULL";
  
$WA_where_comparisonStr "=";
  
$WA_where_fieldNames explode("|"$WA_indexField);
  
$WA_where_fieldValues explode("|"$WA_where_fieldValuesStr);
  
$WA_where_columns explode("|"$WA_where_columnTypesStr);
  
$WA_where_comparisons explode("|"$WA_where_comparisonStr);
  
  
$WA_connectionDB $database_connWatc;
  
mysql_select_db($WA_connectionDB$WA_connection);
  if (!
session_id()) session_start();
  
$updateParamsObj WA_AB_generateInsertParams($WA_fieldNames$WA_columns$WA_fieldValues, -1);
  
$WhereObj WA_AB_generateWhereClause($WA_where_fieldNames$WA_where_columns$WA_where_fieldValues,  $WA_where_comparisons );
  
$WA_Sql "UPDATE `" $WA_table "` SET " $updateParamsObj->WA_setValues " WHERE " $WhereObj->sqlWhereClause "";
  
$MM_editCmd mysql_query($WA_Sql$WA_connection) or die(mysql_error());
  if (
$WA_redirectURL != "")  {
    if (
$WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
      
$WA_redirectURL .= ((strpos($WA_redirectURL'?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
    }
    
header("Location: ".$WA_redirectURL);
  }
}
?>
<script type="text/javascript">
$(function(){
$('#datepicker_1').datepicker({
dateFormat: 'dd/mm/yy',
showAnim: 'show',
onClose: closeDatePicker_datepicker_1
});
});
function closeDatePicker_datepicker_1() {
var tElm = $('#datepicker_1');
if (typeof datepicker_1_Spry != null && typeof datepicker_1_Spry != "undefined") {
datepicker_1_Spry.validate();
}
var docElm = document.getElementById("datepicker_1");
var tBlur = docElm.getAttribute("onBlur");
if (!tBlur) tBlur = docElm.getAttribute("onblur");
if (!tBlur) tBlur = docElm.getAttribute("ONBLUR");
if (tBlur) {
tBlur = tBlur.replace(/\bthis\b/g, "docElm");
eval(tBlur);
}
}
</script>
html:
<td class="WADADataTableCell"><input id="datepicker_1" name="ClosingDate" type="text" value="<?php echo $row_WADAtenders['ClosingDate']; ?>" size="32" /></td>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...