
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2023 03:40 AM
Hi,
I currently have a requirement where, I have variables Prefix, CI Name, Description, and "Security Kafka Topic Name". The value of the "Security Kafka Topic Name" will be a value of these variables separated by "_". The code here is working correctly.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var topic = g_form.getValue("topic_name1");
var contains_space = "";
var more_chars = "";
var regex = new RegExp("^[a-zA-Z0-9]*$");
if (newValue.length > 18) {
alert("More than 18 chacters entered.");
g_form.setValue('description', " ");
} else if (!regex.test(newValue)) {
var no_space = newValue.replace(" ", "_");
g_form.setValue('description', no_space);
g_form.setValue('topic', no_space);
contains_space = "true";
}
}
Now I am asked to add another variable on the form "Data Lake Admins Kafka Topic Name". This variable will hold the same scenario as above, but underscore will be replaced with ".". This is where I am unable to do it. Kindly help with the code adjustment or at least the idea of how to do it.
In the above picture, I am getting the "." because, I am using the client script.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var prefix = g_form.getValue('prefix');
var ci_code = g_form.getValue('ci_code1');
var description = g_form.getValue('description');
g_form.setValue('data_lake_admins_kafka_topic_name', prefix + "." + ci_code + "." + newValue.toLowerCase());
}
Now I am asked to add another variable on the form "Data Lake Admins Kafka Topic Name". This variable will hold the same scenario as above, but underscore will be replaced with ".". This is where I am unable to do it. Kindly help with the code adjustment or at least the idea of how to do it.
Regards
Suman P.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2023 04:36 AM
Hi,
Please try below script:
var prefix = g_form.getValue('prefix');
var ci_code = g_form.getValue('ci_code1');
var description = g_form.getValue('description');
g_form.setValue('data_lake_admins_kafka_topic_name', prefix + "." + ci_code + "." + newValue.replaceAll("_", "."));
}
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2023 04:36 AM
Hi,
Please try below script:
var prefix = g_form.getValue('prefix');
var ci_code = g_form.getValue('ci_code1');
var description = g_form.getValue('description');
g_form.setValue('data_lake_admins_kafka_topic_name', prefix + "." + ci_code + "." + newValue.replaceAll("_", "."));
}
Thanks
Anil Lande