I've created a form which passes all the fields to the Sage CRM. I am also passing the browser date-time to the CRM field using Jquery when someone submits the form (this is to capture the date and time of form submission). The issue I am having is that the Sage CRM only accepts date dd/mm/yyyy format. If the user's browser date format is set up in mm/dd/yyyy format, the CRM is giving me an error(invalid date format).
I've also tried using PHP variables to pull the date and time from the server, but the CRM is not accepting the PHP as well.
I tried installing the WP date-time shortcode plugin and tried to pass the date via a shortcode, and it was not accepted by the CRM either.
Is there a way to achieve this? I've attached my form code below; any ideas or suggestions are welcomed.
<script type="text/javascript">
function CreateAction()
{
if (document.WEB2LEAD.SELECTWorkFlow == null)document.WEB2LEAD.action =
"http://crm.supremeheating.com.au/CRM/eware.dll/SubmitLead?RuleID=";
else document.WEB2LEAD.action = "http://crm.supremeheating.com.au/CRM/eware.dll/SubmitLead?RuleID="
+ document.WEB2LEAD.SELECTWorkFlow.options[document.WEB2LEAD.SELECTWorkFlow.selectedIndex].value;
return true;
}
function MergeFields() {
var leaddetail = jQuery("#lead_detail").val();
jQuery(".jointodetail").each(function(){
if(jQuery(this).val()) {
if(jQuery(this).data("label")){
leaddetail += jQuery(this).data("label") + ": \n";
}
leaddetail += jQuery(this).val() + "\n";
}
});
jQuery("#lead_detail").val(leaddetail);
var lead_desc = jQuery("#lead_description").val();
jQuery(".jointodesc").each(function(){
if(jQuery(this).val()) {
lead_desc += jQuery(this).val() + " - ";
}
});
jQuery("#lead_description").val(lead_desc);
company = jQuery("#lead_companyname").val();
firstname = jQuery("#lead_personlastname").val();
lastname = jQuery("#lead_personfirstname").val();
if(company == "") {
jQuery("#lead_companyname").val(firstname + " " + lastname);
}
var mydate = new Date();
jQuery("#lead_opened").val(mydate.toLocaleDateString());
jQuery("#lead_openedtime").val(mydate.toLocaleTimeString());
jQuery("#leadform").submit();
}
</script>
<FORM Name="WEB2LEAD" id="leadform" method="POST" OnSubmit="return CreateAction();">
<TABLE CLASS=CONTENT WIDTH=100%>
<TR>
<TD>
<SPAN ID=_Datalead_companyname class=VIEWBOX >
<input type="text" CLASS=EDIT ID="lead_companyname" name="lead_companyname" value=""
maxlength=60 placeholder="Company Name: *">
<input type="hidden" name="_HIDDENlead_companyname" id="_HIDDENlead_companyname" value=""
entryType="10">
</SPAN>
</TD>
</TR>
.
.
.
.
<TR>
<TD>
<SPAN ID=_Datalead_How_Can class=VIEWBOX >
<textarea name="lead_How_Can" ID = "lead_how_can" data-label="How can we help you"
class="jointodetail" rows=5 cols=30 placeholder='How can we help you?'></TEXTAREA>
<input type="hidden" name="_HIDDENlead_How_Can" id="_HIDDENlead_how_can" value=""
entryType="11">
</SPAN>
</TD>
</TR>
</TABLE>
<span class="submit">
<input type="hidden" name="lead_opened" id="lead_opened" value="" entryType="22">
<input type="hidden" name="lead_opened_TIME" id="lead_openedtime" value="" entryType="22">
<input type="hidden" name="RuleID" id="RuleID" value="">
<input type="button" value="Save and Submit" onClick="MergeFields();">
</span>
</FORM>
</BODY>
</HTML>
This the PHP variables I used to send the date to the CRM:
<input type="hidden" name="lead_opened" id="lead_opened" value="" entryType="22"> <input type="hidden" name="lead_opened_TIME" id="lead_openedtime" value="" entryType="22">