How to hide fields when override forms in FOSUserBundle - fosuserbundle

I want to override the edit user form in FOSUserbundle to hide some fields, I created my type extending AbstractType, I know how to add fields but not how to hide existing ones like username and/or password.
Actually I can hide the username doing
$builder->remove('username');
how can I hide the password? doing $builder->remove('password'); or $builder->remove('current_password'); doesn't work
thanks

Related

How to add Two recipient dynamically from Send with DocuSign button placed Object?

From X Object i have placed Send with DocuSign button From that X Object i have email field first recipient and another for user email so i need to add these both field as a recipient dynamically
Please can anyone help
You may be able to use our embedded signing example (or similar code) to customize the button to your use case.
You could use the recipient class for different methods and properties. https://developers.docusign.com/docs/salesforce/apex-toolkit-reference/recipient.html
You may also use this guide on how to use the Apex Toolkit to send responsive HTML documents with dynamically set tabs
https://www.docusign.com/blog/developers/the-trenches-use-the-apex-toolkit-to-send-responsive-html-documents-dynamically-set

Disabling Input Field when value is pre-populated

An edit, and add user form group utilizes the same view. However on edit, the username, password, and other details are autofilled into the form instead of presenting a blank form. The form (specifically for username) needs to be disabled, if and only if the field was pre-populated.
Using ng-readonly or ng-disabled works when the user is editing the form (username is disabled if username.length is true).
ng-readonly="username.length"
However, when the user is creating a new profile, typing in one letter into the username field will disable it, as ng-readonly recognizes that the username field has a length of 1. How would I set it so that Angular only checks to make the field read-only once instead of constantly monitoring changes in the field. The other problem is that I don't want Angular to completely ignore the field's changes, as validation (such as min length and isrequired) still need to fire.
Presumably you have a way of knowing whether or not the form is in 'add' or 'edit' mode. Can you just replace the condition of ng-readonly with an "isAdding" boolean?

Panel Pane visibility rule based on users in entity reference field

I have a content type called 'company' with an entity reference field called 'company_managers' referencing users who will be allowed to add and edit other content types relating to this company.
The company node is displayed using panels. What I am struggling with is to create a visibility rule which will only show a panel-pane if the logged in user is referenced in the entity field 'company_managers' this will allow me to show panel panes specific to users in the 'company_managers' field.
So the psudo logic for the visibility rule would be:
Check if logged in user is contained in 'company_managers'
If yes show panel-pane
if no
dont show pane.
This seems such a simple use case that i dont want to create custom code it must be achievable 'out the box' I just cant seem to get to the answer. So after two days of researching am asking for help.
NOTE: have spoofed this behavior using the visibility rule content manager and manually selecting a user on this site. All I would need is to put in the logged in user but I dont think you can put in dynamic variables or tokens.
Help much appreciated.

Add a label custom field in Salesforce Page

I'm trying to put a checkbox in a salesforce page but the problem is that the required message is more than 40 characters so it doesn't fit in the checkbox label (40 character max)
I tried adding two custom fields on top of the checkbox but the problem that these fields even though if they are read only the user can edit there content(text(255)) or not be able to see them(formula(text)) in edit mode.
Is there any way I can do that without creating a custom page and appending it in the page?
It isn't an ideal solution but you could create a new section on your page layout which will allow more text than a label to be displayed. Then only put your confirmation check box field in that section.
That will affectively give you the long label description you are looking for.
You can create a very simple Visualforce page:
<apex:page standardController="Account" showHeader="false" sidebar="false">
I confirm that the new account is open
</apex:page>
Set the controller to your object; I use "Account" here.
You then insert the Visualforce page directly into the page layout, just like you would a field.
It sounds like you need visualforce or S-Controls (now deprecated)
An alternate is to make a text box and prepopulate it with the info, but I think that too would need those technologies
If you come up with a solution to this- let me know.

Visualforce Custom lookup visualforce page

I was wondering if there is a way to override the native functionality of the lookup field in Salesforce and replace it with a visualforce page. The reason I'm trying to override this button is because when the user does a look up, the look up returns everybody with that name. What we want to return is a list of all the contacts by account for the contact being searched.
Here's what I'm trying to achieve:
When the user clicks the lookup button my visualforce page will launch and allow the user to see the account and all the contacts of that account.
Is this even possible? What other ways would you suggest going about this?
Here's a screen shot of what I'm trying to change:
Thanks for all your help!
It sounds really like you just need to customise the columns on the lookup to make it better suited to your needs. If you go to Setup -> Customize -> Contacts -> Search Layouts, you'll see entries for Lookup Dialogs and Lookup Phone Dialogs, there you can edit the columns displayed in the lookup windows.
If you really need a custom solution:
You can't override the lookup page itself, but you could create a new visualforce page for your account, using <apex:detail> and other similar tags to make your life simpler. Then you could include a search section underneath, where a user can enter various search terms which you put into a dynamic SOQL query and then render the results for them to choose from.
yeah its possible by javascript as i did by visual force page that will show the records of related lists and upon selection id of that record passed to parent window by jscipt. and performed same functionality ..
As far as I know - NO.
As a workaround you can use JavaScript.
What we did in our situation? We implement everything in JavaScript. We created an inputText and right on the right of this inputText we placed image with this lookup icon. On image click we create ExtJS popup window (I think you can simply create VF page and show this page in popup window). After window was closed you fill in the inputText field.
There's no out-of-the-box override for this button, last I checked, so something custom would be required. If you're set on having a popup and do not want an inline solution, I'd recommend reviewing this tutorial to get familiar with some of the issues with popups in Visualforce.
But considering what you are looking to accomplish, you could also have your account and filtered list of all contacts associated with that account appear inline on your page when the user clicks a new, custom search button. Of course that page would itself be in Visualforce (or inline Visualforce in a standard page layout) - which you may or may not want to have to code and maintain.
The AJAX Toolkit might also be a good place to start if you want to go with a custom JavaScript button placed on a standard page layout.

Resources