- 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 11:15 AM
have you tried above onChange() script to be created on catalog item?
Have you replaced the variables with correct variable name?
I hope both these fields are string?
Regards,Sushant Malsure
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
08-03-2023 11:18 AM
In check digit I need to get first character from PHname. So in your code there is no pH name right? How it will be working
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
08-03-2023 11:30 AM
I am using that under newValue as the client script is written on change of PH last name.
my code works perfectly and tested on my PDI.
i think you are not getting what is explained above .
Regards,Sushant Malsure
- 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 11:26 AM
yeah I tried this, but it's not working
