Can't add picture in multiple line field

Good day, @mnikitina
I have an rich multiple line filed. Have an user with read permission. He can create items. But when he is trying to add a picture in this field there is no permissions it asks to insert credentials. Only system account can add and users with the full control. How can I allow to simple users to add picture in a field?
image

P.S
I tried drag&drop. It works! Is it a way to work from dropdown menu - insert a picture?

That's a pitty.. drag&drop works only in firefox ... rest of browsers no ((

If it doesn't work. is it a way to make attachment readable , but with adding new files. If i open attachments everyone who have edit to list item can remove it. But when i make it read only - nobody can attach files.

Hello @ixxxl,

To insert an image to the enhanced rich text field user should have edit permission to the SitePages library, as the image is uploading to the library first.

Regarding the attachments field, you can simply hide delete button so that a user cannot remove files.

$(fd.field('Attachments').$el).find('[aria-label="Remove"]').hide()

@mnikitina
yes user have permission to upload image to site active library and edit to site pages. No result
i will with attachment , thank you

and this one
$(fd.field('Attachments').$el).find('[aria-label="Remove"]').hide()
i put it on function on load but still can remove files. Where i make mistake?
image

fd.spRendered(function() {

function disableFields() {

     //Add current user to form field

//fd.field('Utilizator').value = _spPageContextInfo.userLoginName;

fd.field('Specialist').value = _spPageContextInfo.userLoginName;

//Hide system fields

$('.sysfields').hide();

fd.field('Solu_x021b_ia').value = null;

fd.toolbar.buttons[0].style = "display: none;";

$(fd.field('Attachments').$el).find('[aria-label="Remove"]').hide();

}

  // Calling setValue  when the user changes Category selection



// Calling setValue on form loading

disableFields();

});

Hello @ixxxl,

Users should have permission to upload files specifically to this folder:
{site URL}/SitePages/PlumsailForms/Images

Please check if users have access to it.

Do you want users to be not able to delete the attachments they've just uploaded?

In this case, you need to add this code:

fd.spRendered(function() {
    $(fd.field('Attachments').$el).find('[aria-label="Remove"]').hide();
    
    fd.field('Attachments').$on('change', function() {
        $(fd.field('Attachments').$el).find('[aria-label="Remove"]').hide();
    });
});

Also, please make sure that you are using the internal name of the field in the code.

@mnikitina
{site URL}/SitePages/PlumsailForms/Images
I don't have map Images by this url. If I add image with system account it is stored in active site library. I checked user have edit permissions to this library. but still no result

I create this folder , grant permissions to edit, but no luck.. stil asking password and didn't insert image.

  1. I want the user now opened form to deny delete files existing in attachment element from previous user, but allow current user to add some files.
    i added this code , something not works.
    fd.spRendered(function() {
    $(fd.field('Attachments').$el).find('[aria-label="Remove"]').hide();

    fd.field('Attachments').$on('change', function() {
    $(fd.field('Attachments').$el).find('[aria-label="Remove"]').hide();
    });
    });


@ixxxl,

  1. When you add an image to a rich text box, what is the URL of the image? You can check this by right-clicking on the image >> Copy Image Address.

  1. Are you getting any errors in the browser console (F12) on form load?
    Please share the screenshot.

You can also try this code line:

$(fd.field('Attachments').$el).find('[title="Remove"]').hide()

@mnikitina

  1. image is on my desktop, i add it in multiple field . On rich text field it doesn't have such option t oview url.

  2. It seems no errors .

I tried this code in browser.
image
and put in form. the result is the same ....

@ixxxl,

  1. When you open the form in the browser and insert an image to the field, what is the URL of the uploaded image? Check with the account that can upload the image to the field.
    image

  2. To run code from the console, you need to define fd and $ globally , before spRendered event in the JavaScript editor like this:
    image

window.fd = fd;
window.$ = $;

What version of the desktop application are you using? You can find it in the top right corner of the application. Please share the screenshot.

1 Like

@mnikitina

  1. the image url is mysite/sites/help/SitePages/PlumsailForms/Images/2020-10-08/53739d6b-705b-4f31-a87c-2325461a9857.jpg
    I just re-add permissions for domain users for edit, and now it works!!! Thank you very much !!
    image
    And it is stored in /SitePages/PlumsailForms/Images.
    But another problem... after saving form, i enter one more time to see this image and this field is emty..This happens with both account either system account either simple user
    image
    Field is disabled by default on load form another view.

  2. image
    1.4.8
    From console browser


    But still can remove files. Maybe some css will work as you mentioned me in databale to disable recycle and new buttons?

P.S.
It works....... I changed Remove to $(fd.field('Attachments').$el).find('[title="Elimină"]').hide()
it's because the language site. Thank you very much !!! remain to resolve first one :slight_smile:

1 Like

@ixxxl,

  1. Is that a SharePoint field or a Common field? Do you see the picture in a list view?

  2. Ok, I see. I'm sorry, that is my bad. The universal way to hide the delete button would be to hide it by CSS class, like this:

$('.k-upload-action').hide()

@mnikitina

  1. it is a sharepoint multiple field (selected in option rich text field )
    image
    And i can't see the picture on my list view. It's now only save's , but on opening it's null....
  2. Thanks for resolution with CSS too !!! where i should put it ? i tried it in css and in javascript. doesn't work.
    From browse console

Hello @ixxxl,

I'm sorry, I've missed your post.

  1. Please remove the field from the form, save it, and then add the SharePoint field to the form. Make sure you've added the SharePoint field, not the common field.

  2. The code should be added to JavaScript editor, under spRendered event, like this:

fd.spRendered(function() {
     $('.k-upload-action').hide();
});
1 Like

Hi @mnikitina

  1. I tried to create another list,add multiple field - and it works!!
    One thing is that users have edit to site pages and can create now pages.That'n not good.
  2. Thanks it's works!

I think i will use method 2 , because in this case users will not have permissions edit to site pages.
Thank you so much!

1 Like