Giter Site home page Giter Site logo

Comments (31)

afawcett avatar afawcett commented on July 30, 2024

Thanks for sharing. Do you have a question or a problem you want to ask me about?

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

IMPORTANT REQUEST: When you share source code it is not easy to read and makes it harder for me to help you. Please read this and make sure by clicking the Preview tab when making requests that your question and source code is readable.

from apex-mdapi.

mahesh10811f0011 avatar mahesh10811f0011 commented on July 30, 2024

Hi Andrew Fawcett,
Below link i pasted my code

https://github.com/mahesh10811f0011/apex-mdapi/blob/eaebebfdeb75aa35674fb74071a21f58c3d9a0c2/Multipicklists%20%20checkboxes

please help me..........

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

I am sorry, this time i have no idea at all what you want help with??? You just keep sending me really badly formatted code and what look like statements of requirements? You don't tell me what you have been trying, what errors your getting or anything? Sorry if I am missing something?

from apex-mdapi.

mahesh10811f0011 avatar mahesh10811f0011 commented on July 30, 2024

Hi Andrew Fawcett,
That code success but small problem.I try to display all multipicklists Dynamically as checkboxes in an visualforce page Dynamically.I got checkboxes but multipicklists and checkboxes both display on visualforce page.I want only Multipicklist related fieldname with checkboxes.

help me.......

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

Still trying to understand your problem, can you share screenshots, with arrows pointing to the problem?

from apex-mdapi.

mahesh10811f0011 avatar mahesh10811f0011 commented on July 30, 2024

Hi andrew Fawcett ,
Thank you for Reply
multi

I want to only Multipicklists Field Name and checkboxes

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

Please put 4 space characters in front of every line when you past code, notice how in your last response the code is leaking out of the grey box?

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

I think you needed to use the 'rendered' attribute on the apex:inputField to conditionally hide it when the field is a multi-picklist type.

from apex-mdapi.

mahesh10811f0011 avatar mahesh10811f0011 commented on July 30, 2024

Hi andrew Fawcett,

Without using fieldset I displayed all fields dynamically .I will use rerender means all fields will be hide
page like:
apex:repeat value="{!listObjectFields}" var="fieldAPIName" >
<apex:inputField value="{!sObjectToBind[fieldAPIName]}" style="" rendered="{!Render}">

           <apex:selectCheckboxes value="{!checkboxSelections}" layout="PageDirection" >
<apex:selectOptions value="{!MyCheckboxes}"/>

/apex:selectCheckboxes
/apex:inputField

public list selectOption getMyCheckboxes(){

  string objectname ='rajesh__MForm__c';

list SelectOption options = new list SelectOption ();

Schema.sObjectType objType = sObjectToBind.getSObjectType();

  Schema.DescribeSObjectResult objDescribe = objType.getDescribe();

map    String, Schema.SObjectField   fieldMap = objDescribe.fields.getMap();


for(Schema.SObjectField field : fieldMap.values())
{

  Schema.DescribeFieldResult fieldResult = field.getDescribe();

    if(fieldResult.getType() == Schema.DisplayType.MultiPickList)
    {

         Schema.Picklistentry[] values = fieldResult.getPickListValues();

         Map    String, String> picklists = new Map   String, String  ();

         for(Schema.Picklistentry val: values)
         {
         picklists.put(val.getLabel(), val.getValue());

         fieldpicklists.put(fieldResult.getName(), picklists);
          options.add(new SelectOption(val.getValue(), val.getLabel()));
          }

   }

}
return options;

}

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

I am talking about using the rendered attribute not the rerender attribute.

Something likes this...

<apex:repeat value="{!listObjectFieldInfoList}" var="fieldInfo">
    <apex:selectCheckboxes value="{!checkboxSelections}" layout="PageDirection" rendered="{!fieldInfo.IsMultiSelectPickList==true}">
        <apex:selectOptions value="{!MyCheckboxes}"/>
    </apex:selectCheckboxes>
    <apex:inputField value="{!sObjectToBind[fieldInfo.fieldAPIName]}" rendered="{!fieldInfo.IsMultiSelectPickList==false}"/>
</apex:repeat>

For this to work you will need to expose an Apex list not just a list of String list fields.

In your controller...

public class FieldInfo
{
    String fieldAPIName {get;set;}
    Boolean IsMultiSelectPickList {get;set;}
}

public List<FieldInfo> listObjectFieldInfoList {get;set;}

from apex-mdapi.

mahesh10811f0011 avatar mahesh10811f0011 commented on July 30, 2024

Hi andrew Fawcett,
Using above code I tried. I got checkboxes but remaining fields not visible only repeated checkboxes without field name visible on my page .I want display all fields in an visualforce page but Insted of multipicklists Fields place checkboxes Dynamically How?

help me..............

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

Are you also setting IsMultiSelectPickList to false when the field is not a multi-select pick list type?

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

You might also want to try something like this...

<apex:pageBlockSection title="Fields" columns="2">
    <apex:repeat value="{!listObjectFieldInfoList}" var="fieldInfo">
        <apex:pageBlockSectionItem rendered="{!fieldInfo.IsMultiSelectPickList==true}">
            <apex:outputLabel value="{!fieldInfo.label}"/>
            <apex:selectCheckboxes value="{!checkboxSelections}" layout="PageDirection">
                <apex:selectOptions value="{!MyCheckboxes}"/>
            </apex:selectCheckboxes>
        </apex:pageBlockSectionItem>
        <apex:inputField value="{!sObjectToBind[fieldInfo.fieldAPIName]}" rendered="{!fieldInfo.IsMultiSelectPickList==false}"/>
    </apex:repeat>
</apex:pageBlockSection>

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

I also spotted a bug, you need to locate the checkboxSelections and MyCheckboxes fields within the each FieldInfo class, so you can support having multiple multi-picklist fields on your object.

<apex:pageBlockSection title="Fields" columns="2">
    <apex:repeat value="{!listObjectFieldInfoList}" var="fieldInfo">
        <apex:pageBlockSectionItem rendered="{!fieldInfo.IsMultiSelectPickList==true}">
            <apex:outputLabel value="{!fieldInfo.label}"/>
            <apex:selectCheckboxes value="{!fieldInfo.checkboxSelections}" layout="PageDirection">
                <apex:selectOptions value="{!fieldInfo.MyCheckboxes}"/>
            </apex:selectCheckboxes>
        </apex:pageBlockSectionItem>
        <apex:inputField value="{!sObjectToBind[fieldInfo.fieldAPIName]}" rendered="{!fieldInfo.IsMultiSelectPickList==false}"/>
    </apex:repeat>
</apex:pageBlockSection>

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

I am afraid that is all the help i can give you today and I will be quite busy for the next few days.

Please also check out this web site, where there is lots of Salesforce help...

Salesforce StackExchange

from apex-mdapi.

mahesh10811f0011 avatar mahesh10811f0011 commented on July 30, 2024

Hi Andrew Fawcett,
I got following error after using above code

mm

Here My code is there below link

https://github.com/mahesh10811f0011/apex-mdapi/blob/master/Multipicklists%20%20checkboxes

Please send me
[email protected]

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

The Visualforce page code here does not look like the examples i've given you?

from apex-mdapi.

mahesh10811f0011 avatar mahesh10811f0011 commented on July 30, 2024

Hi Andrew Fawcett,
Thai is old code Now i added that location

https://github.com/mahesh10811f0011/apex-mdapi/blob/master/Multipicklists%20%20checkboxes

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

Your always passing true?

listObjectFieldInfoList.add(new FieldInfo(fieldResult.getName(),TRUE,fieldResult.getLabel()));

You need to pass true for multi select picklist fields and false for all others.

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

Your also not populating MyCheckboxes in your FieldInfo class.

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

Please at least try to debug your code.

from apex-mdapi.

mahesh10811f0011 avatar mahesh10811f0011 commented on July 30, 2024

Hi afawcett ,
This i completed means I complete my metadata project.Not now i try to different ways (from one week to )i saw in debug also but debug logs i removed on that code

from apex-mdapi.

mahesh10811f0011 avatar mahesh10811f0011 commented on July 30, 2024

Hi afawcett,
please help me.........

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

Have you tried my last two suggestions?

from apex-mdapi.

mahesh10811f0011 avatar mahesh10811f0011 commented on July 30, 2024

Hi Andrew Fawcett,
i try to if and else coditions , In if condition i gave when multiselectpicklist came change these picklists values are checkboxes ,In else condition Multipicklists all disabled and remaining fields i gave True.But there is no result.I con't able to populate MyCheckboxes in my apex class

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

Hi, sorry for the late response, are you still struggling with this?

from apex-mdapi.

mahesh10811f0011 avatar mahesh10811f0011 commented on July 30, 2024

YES

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

I'm not sure how i can help you, i am finding it really hard to understand at this point.

I also don't have a lot of time to debug your code for you.

I can only give you suggestions of things to try, but at the moment i don't have any more suggestions.

I know this is not an issue with the Apex Metadata API and more to do with your Visualforce page and code, so I will close this issue.

I can still try to help you here though, just not sure how at this time...

from apex-mdapi.

yuvrajdeveloper avatar yuvrajdeveloper commented on July 30, 2024

Hi Andrew,
I need to show display the pageblocksection based on multiselect picklist chosen.
Say for the example, I have the multipicklist field in contact object, where the values are one, two, three.
Whenever i choose "One" Option corresponding page block must be showned.

<apex:page standardController="Contact" showHeader="false">
    <apex:pageBlock >
        <apex:pageBlockSection >
            <apex:inputField value="{!contact.Choose_Number__c}">
                <apex:actionSupport event="onchange" reRender="ppc" />
            </apex:inputField>
        </apex:pageBlockSection>
        <apex:pageBlockSection title="PPC Test" id="ppc" rendered="{!contact.Choose_Number__c == 'PPC'}">
        </apex:pageBlockSection>
    </apex:pageBlock>
    </apex:form>
</apex:page>

Could you help me to achieve this?

from apex-mdapi.

afawcett avatar afawcett commented on July 30, 2024

@yuvrajdeveloper this is not the correct issue, nor the correct repository to be asking this type of general vf question. I have however in this instance, responded to your other issue, lets continue chatting on that one.

from apex-mdapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.