Unexpected end of JSON input
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 04:26 AM
Hi All,
We have below requirement If action have five drop downs
Action:1) Add Assitant
2) Change Assistant
3) Remove Assistant
4)Add Delegate Access (non-assistant)
5) Remove Delegate Access non assistant
I'm trying to achieve this on submit client script using this script but we have selected options in action as Remove Assistant & Remove Delegate Access non assistant if we select these option in action when we submit we are getting the this error('Unexpected end of JSON input' ) in JavaScript console. please let know the reason why we are getting this error in this two case only please provide the exact solution.
var peopleSupported = JSON.parse(g_form.getValue("IO:7b2ca032db36d01074e716f35b9619b3"));
var removeassistant = g_form.getValue('assistant_name_to_add');
var action = g_form.getValue('action');
var previousassistant = g_form.getValue('previous_assistant_name');
var NewAssitstant = g_form.getValue('new_assistant_name');
//alert(action);
for (var i = 0; i < peopleSupported.length; i++) {
var name = peopleSupported[i].names_of_the_people_supported;
// Compare variable name to other values
if ((action == 'Add Assitant' || action == 'Add Delegate Access (non-assistant)') && (removeassistant == name)) {
// g_form.clearValue('assistant_name_to_add');
//g_form.showFieldMsg('assistant_name_to_add', 'Assistant or Delegate Name to Add and Names of the people supported cannot be the same.', 'error');
alert('Assistant or Delegate Name to Add and Names of the people supported cannot be the same.');
return false; // Prevent form submission
} else if (action == 'Change Assistant' && previousassistant == NewAssitstant) {
alert('Previous assitant/New Assitant/People supported cannot be same');
return false;
} else if (action == 'Change Assistant' && previousassistant == name) {
alert('Previous assitant/New Assitant/People supported cannot be same');
return false;
} else if (action == 'Change Assistant' && NewAssitstant == name) {
alert('Previous assitant/New Assitant/People supported cannot be same');
return false;
}
}
return true;
Please let me know what I'm missing here. please provide exact code.