<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Catalog form validation in ServiceNow AI Platform forum</title>
    <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/catalog-form-validation/m-p/3136350#M200871</link>
    <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/804611"&gt;@Prakash_S&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can use onChange catalog client script on Justification variable&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
g_form.hideFieldMsg('justification');
    // Check if the Hardware Type is 'Laptop'
    if (g_form.getValue('hardware_type') == 'Laptop') {        
        // Check if the Justification field has fewer than 50 characters
        if (newValue.length &amp;lt; 50) {
            g_form.showFieldMsg('justification', 'Justification must be at least 50 characters long.', 'error');
        } 
    } 
}&lt;/LI-CODE&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Dec 2024 07:32:40 GMT</pubDate>
    <dc:creator>Ankur Bawiskar</dc:creator>
    <dc:date>2024-12-27T07:32:40Z</dc:date>
    <item>
      <title>Catalog form validation</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/catalog-form-validation/m-p/3136348#M200870</link>
      <description>&lt;P&gt;I have one catalog item with filed&amp;nbsp;Hardware Type (dropdown: Laptop, Desktop, Monitor, etc.) and justification.&lt;/P&gt;&lt;P&gt;My requirement is If "Hardware Type" is "Laptop" and the "Justification" field is less than 50 characters, display an error message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2024 07:25:23 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/catalog-form-validation/m-p/3136348#M200870</guid>
      <dc:creator>Prakash_S</dc:creator>
      <dc:date>2024-12-27T07:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Catalog form validation</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/catalog-form-validation/m-p/3136350#M200871</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/804611"&gt;@Prakash_S&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can use onChange catalog client script on Justification variable&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
g_form.hideFieldMsg('justification');
    // Check if the Hardware Type is 'Laptop'
    if (g_form.getValue('hardware_type') == 'Laptop') {        
        // Check if the Justification field has fewer than 50 characters
        if (newValue.length &amp;lt; 50) {
            g_form.showFieldMsg('justification', 'Justification must be at least 50 characters long.', 'error');
        } 
    } 
}&lt;/LI-CODE&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2024 07:32:40 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/catalog-form-validation/m-p/3136350#M200871</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2024-12-27T07:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Catalog form validation</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/catalog-form-validation/m-p/3136351#M200872</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/804611"&gt;@Prakash_S&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;You can write onChange clint script.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if (g_form.getValue('hardware_type') === 'Laptop') {
        g_form.setMandatory('justification', true);
        if (g_form.getValue('justification').length &amp;lt; 50) {
            g_form.showErrorBox('justification', 'Justification must be at least 50 characters for Laptop requests.');
        } else {
            g_form.hideErrorBox('justification');
        }
    } else {
        g_form.setMandatory('justification', false);
        g_form.hideErrorBox('justification');
    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Runjay Patel - ServiceNow Solution Architect&lt;BR /&gt;YouTube: &lt;A href="https://www.youtube.com/@RunjayP" target="_blank"&gt;https://www.youtube.com/@RunjayP&lt;/A&gt;&lt;BR /&gt;LinkedIn: &lt;A href="https://www.linkedin.com/in/runjay" target="_blank"&gt;https://www.linkedin.com/in/runjay&lt;/A&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2024 07:33:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/catalog-form-validation/m-p/3136351#M200872</guid>
      <dc:creator>Runjay Patel</dc:creator>
      <dc:date>2024-12-27T07:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: Catalog form validation</title>
      <link>https://www.servicenow.com/community/servicenow-ai-platform-forum/catalog-form-validation/m-p/3136355#M200873</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/804611"&gt;@Prakash_S&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you will require 1 more onChange client script on Hardware type&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
g_form.hideFieldMsg('justification');
    // Check if the Hardware Type is 'Laptop'
    if (newValue == 'Laptop') {        
        // Check if the Justification field has fewer than 50 characters
        if (g_form.getValue('justification').length &amp;lt; 50) {
            g_form.showFieldMsg('justification', 'Justification must be at least 50 characters long.', 'error');
        } 
    } 
}&lt;/LI-CODE&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Dec 2024 07:39:41 GMT</pubDate>
      <guid>https://www.servicenow.com/community/servicenow-ai-platform-forum/catalog-form-validation/m-p/3136355#M200873</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2024-12-27T07:39:41Z</dc:date>
    </item>
  </channel>
</rss>

