This topic is locked

Concatenating field values and Date

5/6/2019 7:02:53 AM
PHPRunner General questions
G
gagsoft author

Please excuse my ignorance. I just started working with javascript
In the Add Page JavascriptOnLoadevent I want to concatenate

a constant text "C-", 2 digit current year and the Auto Inc number of the current register table

to create a value that must go into a request number field.

Would appreciate it if someone could just give some guidance as to how to achieve this.

Kindly see example; C-19-1858
{
var ctrlRequest = Runner.getControl(pageid,"Reqnum");

var ctrlRegID = Runner.getControl(pageid,"Register_ID" );

var ctrlprefix = "C-";

var ctrlhyphen = "-";

var ctrlrequest = ctrlSampleID.substring(5.5)

var ctrltwoDigitsCurrentYear = String(Date().getFullYear().substr(2,2));
}
Thanks

admin 5/6/2019

What results this code produces currently?

G
gagsoft author 5/6/2019



What results this code produces currently?


none.....The field is blank

admin 5/6/2019

Use setValue() function to assign a value to control:

https://xlinesoft.com/phprunner/docs/ctrl_setvalue.htm