- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2023 10:42 AM
This are two fields in catalogue form.
PH last name- Mary
Check digit- when you entered something in field"PH last name" then the starting ( First character) letter of name will.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2023 11:25 AM
Hi @User267 ,
Hope you are doing great.
Create on change client script on last name field and try usig below script in onchange function:
var lastnameField = g_form.getValue('lastname');
if (lastnameField.length > 0) {
var firstCharacter = newValue.charAt(0);
g_form.setValue('check_digit', firstCharacter);
} else {
g_form.clearValue('check_digit');
}
Regards,
Riya Verma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2023 10:46 AM
Can you describe more this business requirement ?
What is already there and what is expected outcome with screenshots?
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2023 11:01 AM
In a catalog form , I have created two variables i.e- Lastname and check digit.
So when a user entered something in last name field then automatically (starting character which user entered in last name) should appear in check digit field .
For example:
Lastname -Hello (user entered hello)
Check digit -H( it should automatically get first character)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2023 11:09 AM
I do not know the exact scenario here but here is onChange() script you need to create on catalog item which runs on change of last_name variable:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '' || newValue == oldValue) {
return;
}
var valToSet = newValue.substring(0, 1);
g_form.setValue('check_digit',''); // replace with correct variable name of check digit
g_form.setValue('check_digit',valToSet); // replace with correct variable name of check digit
//Type appropriate comment here, and begin script below
}
Regards,Sushant Malsure
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2023 11:12 AM