Save button script

Mag_ Tomer Harp
Giga Expert

Hello,

When creating a new KB Article and trying to add an image, this popup appears.

I would like to find the script which is called while clicking on the 'Save' button.

 

find_real_file.png

1 ACCEPTED SOLUTION

Hi @Tomer Harpaz 

Technically, this is possible to implement. 

Before proceeding with the technical solution, I would like to mention it that this will be a global change on the platform across the HTML fields and will require customization to OOB component.

Navigate to the module "UI Page' as shown below:

find_real_file.png

Search for the UI page name as "html_insert_image_dialog" as shown below:

find_real_file.png

Now in Client Script you need to add below lines of code after line number 134 as mentioned below:

var getAltText = gel('f_alt').value;
	if(getAltText == ''){
		alert('Please enter a alternate text');
		return false;
	}

Sharing a screenshot as well for reference:

find_real_file.png

Result:

Now when user tries to save the form without adding the Alt text then they will get an alert and will not allow to save the form as shown below:

find_real_file.png

This works for me in my PDI as you want.

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

View solution in original post

3 REPLIES 3

Rogers Cadenhe1
Giga Guru

That code is in the out-of-the-box UI page html_insert_image_dialog.

If you're trying to do something after the image is added instead of changing the behavior of the UI page, inserted images show up on the sys_attachment table as new records with a Table Name field value of "kb_knowledge". You could write a business rule on sys_attachment.

Thx,

What I want to do is NOT to allow saving with an empty Alt Text.

Hi @Tomer Harpaz 

Technically, this is possible to implement. 

Before proceeding with the technical solution, I would like to mention it that this will be a global change on the platform across the HTML fields and will require customization to OOB component.

Navigate to the module "UI Page' as shown below:

find_real_file.png

Search for the UI page name as "html_insert_image_dialog" as shown below:

find_real_file.png

Now in Client Script you need to add below lines of code after line number 134 as mentioned below:

var getAltText = gel('f_alt').value;
	if(getAltText == ''){
		alert('Please enter a alternate text');
		return false;
	}

Sharing a screenshot as well for reference:

find_real_file.png

Result:

Now when user tries to save the form without adding the Alt text then they will get an alert and will not allow to save the form as shown below:

find_real_file.png

This works for me in my PDI as you want.

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke