Jump to content


  • Posts

  • Joined

  • Last visited

ychaudhry's Achievements


Newbie (1/14)



  1. I have a submission page that will calculate the Week number QTR and YR based on tomorrows date. I would like to be able to allow entry into the DeliveryDate field and use that date for calculations while defaulting to tomorrow if left blank. My working javascript for tomorrow is below. <SCRIPT LANGUAGE="JavaScript"> Date.prototype.getWeekNumber = function(){ var d = new Date(+this); d.setHours(0,0,0); d.setDate(d.getDate()+4-(d.getDay()||7)); return Math.ceil((((d-new Date(d.getFullYear(),0,1))/8.64e7)+1)/7); }; function calculate() { var today = new Date(+new Date() + 86400000); var dd = today.getDate(); var mm = today.getMonth()+1; var yyyy = today.getFullYear(); var wk = today.getWeekNumber(yyyy,mm,dd); var qtr = 1; if (wk>52){qtr=1} else if(wk<=13){qtr=1} else if (wk<=26){qtr=2} else if (wk<=39){qtr=3} else {qtr=4} document.getElementById("InsertRecordDeliveryDate").value = mm+'/'+dd+'/'+yyyy; document.getElementById("InsertRecordYR").value = yyyy; document.getElementById("InsertRecordWK").value = wk; document.getElementById("InsertRecordQTR").value = qtr; } /* On submitting the webform, the function calculate is executed */ document.getElementById("caspioform").onchange=calculate; </SCRIPT> Any help is appreciated. Thanks
  2. Thanks Jan. I was able to figure out the issue. I had a uneditable field as part of the concatenate. had to change from "EditRecordDate" to [@feild:Date]
  3. I am trying to use Concatenate on a Details page with no luck. I have changed "InsertRecord" to "Edit Record", but still not not working. Below is the code. <SCRIPT LANGUAGE="JavaScript"> function concatenate() { var position1 = document.getElementById("EditRecordDate").value; var position2 = document.getElementById("EditRecordCheck_Number").value; var position3 = document.getElementById("EditRecordLocation").value; var allpositions = position1 + position2 + position3; document.getElementById("EditRecordLookupID").value = allpositions; } document.getElementById("caspioform").onsubmit=concatenate; </SCRIPT> Any suggestions will be appreciated. Thank you
  4. I am trying to set a lower end limit on the date that can be selected. Below is the code I tried it has yet to work. It is being run in conjunction with concatenate script. function validateDate() { var date = document.getElementById('InsertRecordDate').value; if (Date.parse(del_date) < Date.parse("08/07/2015")) { alert("Please enter a date after 08/07/2015"); } } document.getElementById('InsertRecordGuestOrders_Delivery_date').onChange = validateDate(); Any suggestions would be greatly appreciated. Thanks
  • Create New...