0% found this document useful (0 votes)
5 views5 pages

Catalog Script Real Time Requirements

The document outlines several client scripts for a catalog, including validations for start and end dates, ensuring they are set in the future and that the end date does not precede the start date. It also includes a validation for the end date to ensure it is not more than 180 days from the current date, and a numeric validation for a finance client code to ensure only 9-digit numbers are accepted. Each script uses alerts to notify users of validation errors and resets the corresponding fields if the criteria are not met.

Uploaded by

avinash.g7109
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views5 pages

Catalog Script Real Time Requirements

The document outlines several client scripts for a catalog, including validations for start and end dates, ensuring they are set in the future and that the end date does not precede the start date. It also includes a validation for the end date to ensure it is not more than 180 days from the current date, and a numeric validation for a finance client code to ensure only 9-digit numbers are accepted. Each script uses alerts to notify users of validation errors and resets the corresponding fields if the criteria are not met.

Uploaded by

avinash.g7109
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Catalog client script use real time use cases

1. start_date_validation

function onChange(control, oldValue, newValue, isLoading) {

if (isLoading || newValue == '') {

return;

if (g_form.getValue('start_date') != '') {

var dFormat = g_user_date_format;

var tFormat = g_user_date_time_format;

var currentDate = getDateFromFormat(formatDate(new Date(), dFormat), dFormat);

var StartDate = getDateFromFormat(g_form.getValue('start_date'), dFormat);

if (currentDate > StartDate) {

alert(getMessage("Select date in the future"));

g_form.setValue('start_date', '');

2.End_date validation

function onChange(control, oldValue, newValue, isLoading) {


Catalog client script use real time use cases

if (isLoading || newValue == '') {

return;

if (g_form.getValue('start_date') != '') {

var dFormat = g_user_date_format;

var tFormat = g_user_date_time_format;

var EndDate = getDateFromFormat(g_form.getValue('end_date'), dFormat);

var currentDate = getDateFromFormat(formatDate(new Date(), dFormat), dFormat);

var StartDate = getDateFromFormat(g_form.getValue('start_date'), dFormat);

if (currentDate > EndDate) {

alert(getMessage("Desired End Date has to be a date in the future"));

g_form.setValue('end_date', '');

} else if (StartDate != '' && EndDate < StartDate) {

alert(getMessage("EndDate date should not be before Start date"));


Catalog client script use real time use cases

g_form.setValue('end_date', '');

} else {

g_form.setValue('end_date', '');

alert(getMessage('First please select Start Date'));

3.End Date validation 180 Days

function onChange(control, oldValue, newValue, isLoading) {

if (isLoading || newValue == '') {

return;

}
Catalog client script use real time use cases

var end_date = g_form.getValue('end_date');

var today = new Date();

var days_diff = (new Date(end_date).getTime() - today.getTime()) / (1000 * 60 * 60 * 24);

if (days_diff > 180) {

alert('End date cannot be more than 180 days from today\'s date.');

g_form.setValue('end_date', oldValue);

4.Validation client_code_finance only numeric 0 to 9 alllowed

function onChange(control, oldValue, newValue, isLoading) {

if (isLoading || newValue == '') {

return;

var regexp = /\d{9}/;


Catalog client script use real time use cases

if (!regexp.test(newValue)) {

//alert('Please enter 9 digit number');

g_form.clearValue('client_code_finance');

//Type appropriate comment here, and begin script below

You might also like