• Newby
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 0
    Replies
Friends,

I have requirement to disable a picklist field and also clear and disable an input field based on a picklist value.
Say for example : I have picklist-1 and Picklist-2 and a textfield-1

so based on the value from picklist-1, I need to disable and enable  picklist-2 and textfield-1 on my visualforce page both during creating a record and while editing a record.
I have tried actionsupport but can only do rendering of a field, but not disabling and this worked only while editing the record.

It would be really helpful if one of you can help me with an example for the above senario. I am stuck with this issue for quite a long time.

Thanks in advance
MPM
  • March 10, 2014
  • Like
  • 0

 

Hi All,

 

I want to get first two characters from first name and first 2 characters from the last name and then concatenate and save the result of it in the nick name in apex code while creating the user.

 

Can someone please help me with the code.

 

Thanks

 

  • October 11, 2012
  • Like
  • 0

Hi,

 

I have a requirement where in on click of a command link on my visual force page, i wil have to add a new instance of office_name and state in the pageblock table which i have defined in my vf page. Basically I have the pageblock table to display the values from the select clause which i have, but when clicked on a command link another instance along with the existing one should get added

 

Example

I am displaying already

officename

state

 

On click of a command link i need another copy of officename and state to be displayed on the screen.

 

Controller :

 

public class infoController
{
public User objUser{get;set;}
public List<Office_Location__c> objOfficeLocations{get;set;}
public List<medical_license__c> objMedicalLicenses{get;set;}
public string Ids{get;set;}
public integer count{get;set;}
public void loadInfoDetails()
{
    string currentUSERID=UserInfo.getUserId();//ApexPages.currentPage().getParameters().get('Id');
    //Ids=UserInfo.getUserId();
    //objUser=[select  id, Email, FirstName, LastName, CommunityNickname, Alias, Username, Designation__c, Primary_Specialty__c,Additional_Speciality1__c, Additional_Speciality2__c,(Select Office_Name__c, State__c From Office_Location__r)  From User where id = :currentUSERID ];       
    
    objUser=[Select id, Email, FirstName, LastName, CommunityNickname, Alias, Username, Designation__c, Primary_Specialty__c,Additional_Speciality1__c, Additional_Speciality2__c,
    (Select Name, Office_Name__c, Mailing_Address_Line_1__c, Mailing_Address_City__c, User_ID__c, Zip__c, Phone__c, State__c, Fax__c, Delivery_Address_1__c, Mailing_Address_2__c, 
    Delivery_Fax__c, Delivery_Phone__c, Delivery_Zip__c, Delivery_State__c, Delivery_Address_2__c, Delivery_City__c From Office_Location__r), 
    (Select Name, Medical_License_Number__c,State__c, User_ID__c From Medical_Licenses__r) From User u where id = :currentUSERID];
    
    
}
}

 

VF page :

<apex:page controller="infoController" action="{!loadInfoDetails}" showHeader="false" sidebar="false" >

<apex:form >
<apex:outputLink value="{!$Site.Prefix}/secur/logout.jsp" rendered="{!NOT(ISPICKVAL($User.UserType,'Guest'))}">{!$Label.site.logout}</apex:outputLink>
<apex:pageBlock >
<apex:pageblock title="My Info">
<apex:pageblocksection title="Personal Details">
<apex:pageblocksectionitem >
    <apex:outputLabel for="txtUName">User Name</apex:outputLabel>
    <apex:inputText id="txtUName" value="{!objUser.Username}"/>
</apex:pageblocksectionitem>
<apex:pageblocksectionitem >
    <apex:outputLabel for="txtEmail">User Email</apex:outputLabel>
    <apex:inputText id="txtEmail" value="{!objUser.Email}"/>
</apex:pageblocksectionitem>
<apex:pageblocksectionitem >
    <apex:outputLabel for="txtFirstName">First Name</apex:outputLabel>
    <apex:inputText id="txtFirstName" value="{!objUser.FirstName}"/>
</apex:pageblocksectionitem>
<apex:pageblocksectionitem >
    <apex:outputLabel for="txtLastName">Last Name</apex:outputLabel>
    <apex:inputText id="txtLastName" value="{!objUser.LastName}"/>
</apex:pageblocksectionitem>
</apex:pageblocksection>
</apex:pageBlock>

<apex:pageBlock mode="edit" title="Office Locations">
    <apex:pageBlockTable columns="1" value="{!objUser.Office_Location__r}" var="officeLoc"> 
       <apex:column >
           <apex:outputLabel for="txtoffName">Office Name</apex:outputLabel>
           <apex:inputText id="txtoffName" value="{!officeLoc.Office_Name__c}"/>
       </apex:column>
       
       <br> </br>
       <apex:column >
           <apex:outputLabel for="txtstate">State</apex:outputLabel>
           <apex:inputText id="txtstate" value="{!officeLoc.State__c}"/>
       </apex:column>
       
       </apex:pageBlockTable>
       
    

</apex:pageblock>
</apex:pageBlock>
</apex:form>

</apex:page>
  • September 26, 2012
  • Like
  • 0

I have been able to fetch the records from the list and display them in a pageblock,

I want to display the !officeLoc.Office_Name__c and !officeLoc.State__c one below the other instead of next to each other.


as below

!officeLoc.Office_Name__c and
!officeLoc.State__c

 

My VF page :

 

<apex:page controller="infoController" action="{!loadInfoDetails}" showHeader="false" sidebar="false" >

<apex:form >
<apex:outputLink value="{!$Site.Prefix}/secur/logout.jsp" rendered="{!NOT(ISPICKVAL($User.UserType,'Guest'))}">{!$Label.site.logout}</apex:outputLink>
<apex:pageBlock >
<apex:pageblock title="My Info">
<apex:pageblocksection title="Personal Details">
<apex:pageblocksectionitem >
    <apex:outputLabel for="txtUName">User Name</apex:outputLabel>
    <apex:inputText id="txtUName" value="{!objUser.Username}"/>
</apex:pageblocksectionitem>
<apex:pageblocksectionitem >
    <apex:outputLabel for="txtEmail">User Email</apex:outputLabel>
    <apex:inputText id="txtEmail" value="{!objUser.Email}"/>
</apex:pageblocksectionitem>
<apex:pageblocksectionitem >
    <apex:outputLabel for="txtFirstName">First Name</apex:outputLabel>
    <apex:inputText id="txtFirstName" value="{!objUser.FirstName}"/>
</apex:pageblocksectionitem>
<apex:pageblocksectionitem >
    <apex:outputLabel for="txtLastName">Last Name</apex:outputLabel>
    <apex:inputText id="txtLastName" value="{!objUser.LastName}"/>
</apex:pageblocksectionitem>
</apex:pageblocksection>
</apex:pageBlock>

<apex:pageBlock mode="edit" title="Office Locations">
    <apex:pageBlockTable columns="1" value="{!objUser.Office_Location__r}" var="officeLoc"> 
       <apex:column >
           <apex:outputLabel for="txtoffName">Office Name</apex:outputLabel>
           <apex:inputText id="txtoffName" value="{!officeLoc.Office_Name__c}"/>
       </apex:column>
       
       <br> </br>
       <apex:column >
           <apex:outputLabel for="txtstate">State</apex:outputLabel>
           <apex:inputText id="txtstate" value="{!officeLoc.State__c}"/>
       </apex:column>
       
       </apex:pageBlockTable>
       
    

</apex:pageblock>
</apex:pageBlock>
</apex:form>

</apex:page>


  • September 26, 2012
  • Like
  • 0