You are viewing limited content. For full access, please sign in.

Question

Question

Auto populate Requisition Number

asked on December 13, 2016 Show version history

In LF Forms I am trying to auto-populate a "Requisition Number". The format of the req number is

FY-YY-MM-123. FY is constant and is the abbreviation for "Financial Year". MM is the month where the year runs July through June, so July would be month "01". 123 is a sequential number.

I am new to forms so provide as much detail as possible in your answer. I figured I would need a database to transform the months so I created the draft in the attached Excel file. Thanks in advance.

0 0

Replies

replied on December 14, 2016

You can just use custom JavaScript to archive it. In Layout page, add a css class named "req" to the "Requisition Number" field, then use following JavaScript to populate the value.

$(document).ready(function(){
  var today=new Date();
  var year=today.getFullYear().toString().substr(2,2);
  var month=today.getMonth()+1;
  if(month<10)
    month="0"+month;
  var monthSequence={
    "07":"01",
    "08":"02",
    "09":"03",
    "10":"04",
    "11":"05",
    "12":"06",
    "01":"07",
    "02":"08",
    "03":"09",
    "04":"10",
    "05":"11",
    "06":"12",
  }
var getSequence = function (propertyName) {
    return monthSequence[propertyName];
};

var sequence=getSequence(month);

 var value='FY-'+year+'-'+month+'-'+sequence;
$('.req input').val(value);
  
});

 

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.