Hide "create new" link for a cross site lookup field

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
mcgaafar
Posts: 44
Joined: Sun Jan 17, 2016

25 Mar 2016

Hi,

I have a cross site lookup field on one of my form designer's forms that i'm toggling its readonly via js according to certain conditions. The field has "add new" link that i want to hide whenever i disable the field. How do i do that?

Thanks

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

25 Mar 2016

This would hide the button:

Code: Select all

fd.field('csl').control()._el().find('.plumsail-csl > a').hide();
csl is the internal name of the field. Note, you may also want to change height of the control when you hide the button

fd.field('csl').control()._el().css('height', '24px');

mcgaafar
Posts: 44
Joined: Sun Jan 17, 2016

25 Mar 2016

Perfect, thanks a lot.

mcgaafar
Posts: 44
Joined: Sun Jan 17, 2016

06 Apr 2016

This code is not working if the form is opened in modal view, any suggestion to fix this?

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

07 Apr 2016

Opening the form as a modal dialog will not influence this. Probably you are trying to do something different with it. Explain what you're trying to do and I may be able to advise you.

mcgaafar
Posts: 44
Joined: Sun Jan 17, 2016

07 Apr 2016

i'm only trying to hide the link if the form was opened as modal via another form, so i used the same line of code that is working for me in the normal view and placed it inside the if statment that checks if window.top != window.self, but the link is still shown, i even tested more with the same line of code place on form load not inside the if statment to check, it doesn't work as well when the form is opened in modal view via another form

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

07 Apr 2016

Am I right to understand that you're trying to hide the button on form load?

mcgaafar
Posts: 44
Joined: Sun Jan 17, 2016

07 Apr 2016

Actually no, i want to hide it only if the form is opened in modal view via another form, and this situation could happen via different forms. For example a user might be adding a project or a sales opportunity or whatever form that has a contact field(parent form), and then the user clicked on the add new contact link associated with the contact field on the parent form, so the contacts form(child) will be opened in modal view and taking the value of the parent company, now i don't want the contact form(child) to show add new company below the company field that is already auto-populated via the parent form.

User avatar
rostislav
Moderator
Posts: 364
Joined: Mon Oct 19, 2015

08 Apr 2016

If I understood you correctly: Add the following CSS to the page:

Code: Select all

[fd_type="PlumsailLookup"] {
	height: 24px;
}

.plumsail-csl > a {
	display: none;
}

.plumsail-csl-add-visible [fd_type="PlumsailLookup"] {
	height: 41px;
}

.plumsail-csl-add-visible .plumsail-csl > a {
	display: inline;
}
Then you can use the following code to show the button when and as you need to:

Code: Select all

$('body').addClass('plumsail-csl-add-visible');

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 14 guests