• BeeddiskShah
  • NEWBIE
  • 175 Points
  • Member since 2009

  • Chatter
    Feed
  • 7
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 47
    Replies

Hi,

 

I have visual force page where user can enter first name and last name. I made both fields as required with tag required="true" in input text.

 

I see that when user don't enter that field and hit register button, visual force shows message like "
  • j_id0:j_id31:j_id36: Validation Error: Value is required." I want to customize this message as "Validation Error: Value is required".
  •  

    Any help?

     

    Thanks

Hi everyone,

 

MY requirement is up on button action i want to change my apex output text value if he click edit button i want to display output text as "Edit mode' .If i click new button i want to display d output as 'New Mode'....Soi want to change the output text value up on command button i tried by assigning likedis in the clear field function

 document.getElementById('{!$Component.form1.head}').Value='CANCEL MODE';

but its not working So plz help me to achieve this with an example code...

My vpage is as follows

<apex:page standardController="CAF_Bank__c" extensions="variable">
<script>

    function clearflds()
    {

   document.getElementById('{!$Component.form1.head}').Value='CANCEL MODE';
   document.getElementById('{!$Component.form1.name}').value=null;
    document.getElementById('{!$Component.form1.iField}').value=null;
    document.getElementById('{!$Component.form1.bname}').value=null;
    document.getElementById('{!$Component.form1.credit}').value=null;
    }
    </script>
<apex:form id="form1" >
 <table width="100%"> <tr>
      <td width="17%"></td>
      <td align="left" valign="top" height="45"><font style="font-family:Tahoma, Geneva, sans-serif; font-size:16px; line-height:24px; color:#900;"><apex:outputText id="head"  title="Search Mode" value="Search Mode" > </apex:outputText>

   
           </font> </td>
   
      <td></td>
  </tr></table>                                       
<table width="100%">
    <tr>
      <td width="5%"></td>
      <td>
          <table width="100%" align="center">
       

               <tr>
                   <td height="30" width="170px"><apex:outputLabel value="Bank Name">
     </apex:outputLabel></td>
                   <td><apex:inputField id="name" value="{!CAF_Bank__c.Bank_Name__c}">
                    <apex:actionSupport event="onkeyup" action="{!disableEnable}" rerender="buttonSection"/>
                   </apex:inputField>
                   </td>
               </tr>
               <tr>
                   <td height="30"><apex:outputLabel value="Branch Code">
      </apex:outputLabel></td>
                   <td><apex:outputPanel id="branchcoding">
     <apex:inputField id="iField" value="{!CAF_Bank__c.Branch_Code__c}">
      <apex:actionSupport event="onkeyup" action="{!disableEnable}" rerender="buttonSection"/>
      </apex:inputfield>
      </td></tr>
      <script>document.getElementById('{!$Component.iField}').disabled = {!disableInput}; </script>
      </apex:outputPanel> 
              
               <tr>
                   <td height="30"><apex:outputLabel value="Branch Name">
     </apex:outputLabel></td>
                   <td><apex:inputField id="bname" value="{!CAF_Bank__c.Branch_Name__c}">
                    <apex:actionSupport event="onkeyup" action="{!disableEnable}" rerender="buttonSection"/>
                   </apex:inputfield>
                   </td>
                 </tr>
                  </table>
<table align="left"><tr><td align="center">

</td></tr></table>

</td><td width="5%"></td></tr>

</table>
<table width="100%"> <tr>
      <td width="12%"></td>
      <td align="left" valign="top" height="45">
        <apex:outputpanel id="buttonSection">
    <apex:commandButton disabled="{!isNewButtonDisabled}" value="New" onclick="newmode();" action="{!newRecord}" />
      <apex:commandButton disabled="{!isEditButtonDisabled}" value="Edit" action="{!disableCloseDateInput}" onclick=" focussing()"  rerender="branchcoding, buttonSection"/>
              <apex:commandButton disabled="{!isSaveButtonDisabled}" id="button2" action="{!save }" value="Save"   />
      <apex:commandButton value="Cancel"  onclick="clearflds()"  reRender="form1" />

 
  <apex:commandButton action="{!cancel}" value="Exit"/>


  </apex:outputpanel>
      </td>
       </apex:form>
  </tr></table>
 
</apex:page>

 

My controller as follows

 

public class variable {

private static final Boolean DISABLED = false;
private static final Boolean ENABLED = true;
public Boolean disableInput {get; set;}
 boolean isSaveButtonDisabled = false;
  boolean isNewButtonDisabled = false;
  boolean isEditButtonDisabled = false;
List<String> BankBranchList = new List<String>();
ApexPages.StandardController con;
public  variable(ApexPages.StandardController controller){ 
setButtonStatus('save', DISABLED);
setButtonStatus('edit', DISABLED);

setButtonStatus('new',ENABLED);
this.con = controller;
}
Public pageReference move()
{

   PageReference newpage=page.variableheading;
   newPage.setRedirect(true);
   return newpage;
  
   }
 public void save() {

try
{

 con.save();
setButtonStatus('save', DISABLED);
setButtonStatus('edit', ENABLED);
setButtonStatus('new', ENABLED);

}
catch(Exception ex1)
{
}


}

public PageReference newRecord()
{
PageReference pr = System.Page.variableheading; // or 'new PageReference('url');//

pr.setRedirect(true);
return pr;

}
public PageReference hmpgmove()
{
PageReference pr =new PageReference('https://ap1.salesforce.com/home/home.jsp'); // or 'new PageReference('url');//

pr.setRedirect(true);
return pr;


public PageReference create()
{

setButtonStatus('save', DISABLED);
setButtonStatus('edit', DISABLED);
setButtonStatus('new',  DISABLED);
enableCloseDateInput();

return move();

}
public boolean getIsSaveButtonDisabled()
{
  return isSaveButtonDisabled;
}
public boolean getIsEditButtonDisabled()
{
  return isEditButtonDisabled;
}
public boolean getIsNewButtonDisabled()
{
  return isNewButtonDisabled;
}
public boolean getIsDeleteButtonDisabled()
{
  return isDeleteButtonDisabled;
}
  public void disableCloseDateInput()
  {
    setButtonStatus('new', DISABLED);
    disableInput = true;
   
    
 }
   
 
    public void enableCloseDateInput(){
        disableInput = false;
    }
 
public void setButtonStatus(String buttonName, Boolean status) {

status = !status;

if (buttonName == 'save') {

isSaveButtonDisabled = status;

} else if (buttonName == 'new') {

isNewButtonDisabled = status;

} else if (buttonName == 'edit') {

isEditButtonDisabled = status;

}
else if(buttonname=='delete')
{
  isDeleteButtonDisabled = status;
}

}
public void disableEnable() {
setButtonStatus('save', ENABLED);
}
}

 

 

                                                                                                                                          Thanks&Regards,

                                                                                                                                                 Anu....

 

 

 

 

I'm brand new to Visualforce and coding in general, and am trying to figure out how to filter the record results pouring in to my Visualforce Page from a standard controller pulling opportunity records:

 

<apex:page standardStylesheets="false" showHeader="false" sidebar="false" 

standardController="Opportunity" recordSetVar="screening">

 

I want to only show records based around the value of a field on the opportunity page.

 

Thanks in advance for your help. 

 

 

I am trying to use the base of Ron Hess's VF Blog Application found here and I am experiencing a quirk.

 

What is happening is that when in the Edit mode and applying the Font Styling through the use of either the native Rich Text Editor or that of YUI my view page renders with the Font Styling in HTML tags.

 

So lets say inside the Rich Text Editor I write something like:

 

Hi there,

 

What are you doing?

 

Why does this not work?

 

Upon Save my view page looks like:

 

Hi there, <br><br>What are you doing?<br><br>Why does this not work?

 

Any ideas why this is happening?

I am trying to (1)provide list of records, (2)  ability to add new record and (3) edit record on the same page.

I am able to add but not able to edit. any suggestions.

 

I am able to show the list and add to the list. when click on the edit commandlink I want the output panel inputfields to be populated by selected record for edit.

(cannot see my attached image)

 

 

 

Message Edited by Umapen on 11-29-2009 11:52 PM
  • November 30, 2009
  • Like
  • 0
Hi Everyone,

 

Iam facing a small problem when iam trying to link my visualforce page to the standard tab.......When i go to objects edit mode and  under Context-Sensitive Help Setting: If i select Open a window using a Visualforce page...

 

Then in the list of visualforce pages available, I cant find my visualforce pages which i have created recently..it is listing up only the pgs which i have created long ago..but not the pgs which i created now...I dont know wats wrong i even deleted some pgs thinking that whether  pg limit exceeded but still i couldnt find the pgs in the list ,So iam unable to link the pages to standard tab now...

 

So wat would be the  Issue and howcan i get out of this issue................PLz help me .......

 

                                                                                                      Thanks & Regards,

                                                                                                             Anu........
  • November 27, 2009
  • Like
  • 0

I am new to SFDC. Like Development Edition do I get a free Professional /Unlimited Edition where I can create more than two users . I cant create more than two users in Develop edition there by am not able to test my application completely.(Especially where i want to create different workflows for different user)Do any one help me?

 

Thanks,

Neeru.

Hi,

I am facing a very strange VF behaviour. I have a visualforce page button which has a save method.

 

It is a simple command button and all is well so far/

 

Now I have a requirement that I have to trigger a validation (server side validation) and if the validation is not true, a warning message should popup to the user.

 

This method validates the code and sets isRenderedConfirm=true.

 

on Visualforce page I have a small snipet of javascipt

 

  <apex:commandButton value="Save" action="{!ValidateBeforeSave1}" />

<apex:actionFunction action="{!save}" rerender="error" name="saveFuncion"/>

 

 

    <script>
                if('{!isRenderedConfirm}' == 'true')
                {
                       var cnf=confirm(' Proceed?');
                       if(cnf){
                           saveFuncion();
                       }
                   }
        </script>

 

 

Controller:

 

public PageReference ValidateBeforeSave1(){
        System.debug('in getValidateBeforeSave method: '+obj);
        isDateCorrect=ValidationControllerClass.ValidateAgainstSite(obj);
        system.debug('%%%%'+isDateCorrect);
        if(isDateCorrect > 0){
            isRenderedConfirm=true;
        }else{
            isRenderedConfirm=false;
            //Pagereference pg=Save();
            //pg.setRedirect(false);
            //return pg;
        }   
              

        return null;        
    }

 

 

But now the problem is, till confirm box all works fine, but after confirm message it does not enter Save method. The save method is not touched at all.

 

Please help.

Hi,

I am writing a code for sending mass email. The code is working fine, everything is working fine, but I am not receiving any email. It is 24 hrs since I send the mail.

When I checked in Debug Logs, it is showing this error.

 

  Mass email queued for send (pending commit) 

 

Has anyone encountered this problem? What is the solution?

 

The complete debug log:

 

20100113111521.297:Class.InputFileControllerExtension.composeEmail: line 49, column 2:     Number of iterations: 1
20100113111521.297:Class.InputFileControllerExtension.composeEmail: line 59, column 2: Mass email queued for send (pending commit) : bccSender: false, saveAsActivity: false, useSignature: true, targetObjectIds: [00520000000paGK], templateId: 00X20000000tUgMEAU, description: Mass Email (API),
20100113111521.297:Class.InputFileControllerExtension.done: line 36, column 4: returning from end of method public void composeEmail() in 981 ms
20100113111521.297:External entry point: returning System.PageReference from method public System.PageReference done() in 986 ms

Thanks for your help

 

Siddhesh Kabe

http://force.siddheshkabe.co.in

Hi,

I am trying to write a VF page which can add multiple rows of object. Now during data capture there is a lot of data repeatation happening, so I plan to add a copy row functionality on the page.

 

Now as u can c from the figure I did build a VF page but I do not know how do I achieve this functionality.

 

I have a list called 'Packages' which stores Object of Class 'Field',

 

Now obviously when I click on Copy I need to know which field to copy and then I can traverse the Package and add the field object data below it.

 

 

One approach I thought about it was create a Index variable in Field class and increment it by one in constructor.

 

However this happens to be a workaround, is there any standard way to do this? 

 

Any suggestions will be helpful.

Hi,

I have a visualforce page that uses a <apex:inputfield> tag to generate a standard picklist, I have written a inner class on the page to fetch the object along with some extra params i need for the page.

 

However the Picklist behaves strangly in IE 6. Whenever I am selecting a value, from the dropdown a value is automatically selected by the picklist. However when the mouse is moved out, the value is not retained.

 

This seems like a GUI problem and is only seen with IE 6, I tried with IE 7, IE 8 and Firefox 3+ I had no issues of the sort.

 

Does anyone has any answer for why it is behaving this way? Even if there is no solution, I wanted to know what exactly is causing this.

 

Thanks for the help,

Siddhesh Kabe

http://force.siddheshkabe.co.in

Hi,

I wanted to use a dependent picklist in a data table. How to pass a selected value from one picklist into the controller?

 

Once the picklist is selected I want its value to be selected.

Two question:

 

1) Can we remove the pricebooks completely from SFDC? I have a requirement that the price of product will change on Demand and Supply and there is no fix price. 

 

2) Can we modify the add products wizard on Opportunity Line items? I want to add the shipment charges as well for all the products and wish to add it to the wizard when the product is added.

 

Is it possible using VF page? If yes, have anyone worked on something like this before and can share the algorithm or code snippet or a pseudo code.

Hello all,

 

I have a custom object 'Invoice' which is a child to Account obj.

I have few invoice records (example: inv1, inv2, inv3,..) which are already assigned to an account (example: Acc1).

 

Now i want to assign these to another account (example: Acc2).

 

Any pointers how to achieve this is really appreciated.

 

Thanks,

VK

  • March 25, 2011
  • Like
  • 0

Many people were asking about a dynamic approval, where next approval is determined using role hierarchy or some other logic. Just blogged on the issue, hope it helps.

 

http://force.siddheshkabe.co.in/2011/03/dynamic-approval-process-on-salesforce.html

Hi all

 

On the opportunity page, if a button is clicked a wizard pops up. It should contain some opportunity fields and the values for those fields are entered and they are saved using a save button on wizard. Then the values should be saved and displayed back in the opportunity page layout. How can I achieve this? If any body worked on such scenario and if they post sample code that would be great. Thanks!!!

 

 

 

Hi All,

Firstly, thanks for taking the time to look at my post.

I have  vf page that was working very nicely until recently (maybe until spring '11 was launched?). Now, when the user fires an event that calls an actionFunction, the apex method is not being called. I put an actionStatus component into the page to show the status, and it does show the start and stop text, but the debug log shows output appropriate for pageload, not for the method referenced in the actionFunction tag.

Action Function Tag:

 

<apex:actionFunction status="counterStatus" name="renderField" action="{!renderField}" immediate='true' rerender="taskInfoDisplay, descInfo,fundraisingInfo, sysInfo, editButtons">
  <apex:param name="fieldToShow" value=""/>
  </apex:actionFunction>

 

 

Apex Method:

 

public void renderField(){
		System.debug('in renderField');
		fieldToEdit = ApexPages.currentPage().getParameters().get('fieldToShow');
		isEdit = true;
		System.debug('the field to edit is: ' + fieldToEdit);
	}

 

 

Sample Calling Code:

 

<apex:outputLabel ondblclick="renderField('Priority')"  value="Priority"/>

 

 

Does anyone have any ideas as to why this would no longer work?

 

Thanks!

 

  • March 13, 2011
  • Like
  • 0

I have a VF page (called prodinfo ). 

 

On Sandbox

- Accessing as regular VF page (URL looks like http://xxxxx/apex/prodinfo)

- - - HTML version output - works fine

- - - PDF version output (by just adding 'renderas="pdf" in the page tag) - works fine

 

- Accessing as Sites page (after setting up a site to refer to this page. URL looks like http://xxxxx.force.com/prodinfo)

- - - HTML version output works fine

- - - PDF version output (by just adding 'renderas="pdf" in the page tag) - works fine

 

On Production

- Accessing as regular VF page (URL looks like http://yyyyy/apex/prodinfo)

- - - HTML version output - works fine

- - - PDF version output (just by adding 'renderas="pdf" in the page tag) - works fine

 

- Accessing as Sites page (after setting up a site to refer to this page. URL looks like http://yyyyy.force.com/prodinfo)

- - - HTML version output (regular page tags etc.) works fine

- - - PDF version output (just by adding 'renderas="pdf" in the page tag) - FAILS with the dreaded InMaintenance error.

 

There is not change to code other than to add and remove the renderas clause.

 

As soon as I remove the renderas="pdf" part on the page, the VF page on production accessed as a Sites page shows up fine.

 

Any help / information / pointers greatly appreciated.

 

Thanks

SC

Hello

           Can I add  styles to  <apex:pagemessages> ..??   or can  i add custom message for each field.

 

Thank you

Hi all,

 

      I Have problem with salesforce site. I am trying to insert record in standard object through site but i am getting an error that is ,

 

Authorization Required

You must first log in or register before accessing this page.
If you have forgotten your password, click Forgot Password to reset it.

 

-------

 

When i am trying it through visualforcepage on platform its working fine.

 

My VF Page is,

 

<apex:page Standardcontroller="Account">
   
  <apex:form >
   <apex:pageBlock title="Account Info">
 
      <apex:pageBlockButtons >
        <apex:commandButton action="{!save}" value="Save"/>
      </apex:pageBlockButtons>
 
      <apex:pageBlockSection showHeader="false" columns="2">
        <apex:inputField value="{!account.name}" />
      </apex:pageBlockSection>
 
    </apex:pageBlock>
  </apex:form>
</apex:page>

 

 

Can anybody suggest?

 

Thanks,

 

Anuja.

  • March 11, 2011
  • Like
  • 0

HI Everyone,

 

public class TestPage
    {
     public String id{get; set;}
      Boolean userIdNotFound = false;
    List<opportunitywrapper> opportunityList = new List<opportunitywrapper>();//for opportunity
        List<opportunity> selectedopportunity = new List<opportunity>();//for opportunity
        public List<opportunitywrapper> getopportunity()
        {
            for(opportunity o : [select Id, Name from Opportunity Where id =:ApexPages.currentPage().getParameters().get('id')])
            opportunityList.add(new opportunitywrapper(o));
            return opportunityList ;
        }
         public PageReference getSelectedopp()
        {
            selectedopportunity.clear();
            for(opportunitywrapper oppwrapper: opportunityList)
            if(oppwrapper.selected == true)
            selectedOpportunity.add(oppwrapper.opp);
            return null;
        }
        public List<opportunity> GetSelectedopportunity()
        {
            if(selectedopportunity.size()>0)
            return selectedopportunity;//Update Account here
            else
            return null;
        }   
        public class opportunitywrapper
        {
        public opportunity opp{get; set;}
            public Boolean selected {get; set;}
            public opportunitywrapper(opportunity o)
            {
                opp= o;
            selected = false;
            }
        }
    }

 

The above code is working fine when i give any opportunity id on the url to get the opportunit name.

My problem is that when i get the records in list i dnt want to show them on the page and update the account associated with that opportunity.

 

Please help on this as i am new to the salesforce.

Thanxs in advance

Regards

Divyanshu

 

Hi,

 

I have two questions related with Approvals.

 

1. Is their a way to make Approver comments required while approving or rejecting any record?

2.  How can we make any field required on record while some one is approving or rejecting the record?

 

 

Cheers!

Rajan

Hi,

 

I want to convert leads to an opportunity. Please let us know how to map between the Lead's Custom Fields to Opportunities Standard fields and Lead's Standard Fields with Opportunities Custom Fields.

 

Thanks

  • March 07, 2011
  • Like
  • 0

In the code below I place a custom id of primary_contact_phone into the inputField.  When the form field is rendered, the actual markup id is "j_id0:rfq_form:j_id7:primary_contact_phone".  I have some complicated styling to do and I want to create my own <label>s, instead of using the built-in blockSection labels.  So when using the "for" attribute, I want to do <label for="primary_contact_phone">.  Of course, that does not work, I need to have <label for="j_id0:rfq_form:j_id7:primary_contact_phone">.  But this is rendered by Salesforce and I do not know what it will be.  I have been trying to access the id with attempts like  {!$Component.rfq_form.primary_contact_phone}.  I've also been reading on how to access IDs for using with Javascript in the VF reference, and I've done this before.  But I cannot seem to get that darn ID.  Any ideas on how to properly get the ID of the input field?

 

 

 

<apex:page cache="false" sidebar="false" showHeader="false" standardController="RFQ__c">

    <apex:form id="rfq_form">

        <apex:inputField value="{!RFQ__c.primary_contact_phone__c}" id="primary_contact_phone"/>

        ....

    </apex:form>

</apex:page>

 

thanks,

jyg

I want to create my own home page and add my company logo instead of the Salesforce logo. For this I wanted to know what would be the steps. I woudl guess that shoudl be done with a visualforce page, but I dont know how to do it and how do I get the new visualforce page to have the same components as the standard home page.

 

Please help!!

Hello Board,

 

my name is David and i´m new to visualforce development. 

 

We´ve like to change the interface and appearance of our salesforce.com platform. I like to change the tabnav to the following:

 

Layout

 

(German Layout)

 

You see: no tab navigation at the top and some more rounded corners :)

Is this generally possible?

 

Can i do this via some static style resources by inserting them in the current pages or do i have to re-develop the pages instead?

 

Best regards and thanks for any hints!

David 

  • January 27, 2010
  • Like
  • 0

When you use apex:selectList or apex:inputText you get this nasty error message. Something like this:

 

 

I could live with this for internal apps but I am now working on a force.com site that will face customers and partners so this won't fly.

 

Is there anyway to clean this up? I have many other apex:inputFields with required set to true so I can't do inspection on the apex side to see if the field is null and then display a nice clean message as the requiredness of the other fields prevents the apex from executing.

 

Any ideas? Workarounds?

 

Thanks,

Jason

 

  • January 26, 2010
  • Like
  • 0

Hi, 

 

I have built a visualforce page and when using the standard SAVE commandbutton it will show the validation messages on the page, however when using an extension it does not show the validation messages. The reason I am using an extension is because I want to re-direct to another visualforce page.

  

Could someone look at the below code and let me know if I have missed a command that shows the validations

 

 

public PageReference Submit() { insert wreq; PageReference myPage = new PageReference('/apex/engagement_request_review?id=' + wreq.id); myPage.setRedirect(true); return myPage; }

 

 

 

  • January 26, 2010
  • Like
  • 0

Hi,

 

I have visual force page where user can enter first name and last name. I made both fields as required with tag required="true" in input text.

 

I see that when user don't enter that field and hit register button, visual force shows message like "
  • j_id0:j_id31:j_id36: Validation Error: Value is required." I want to customize this message as "Validation Error: Value is required".
  •  

    Any help?

     

    Thanks