• Nisar Ahmed
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 15
    Replies
Hi All,

I am unable to overcome the error 'inputText_Ignoring_FLS' for the below statement which I have used in a VF page.
<apex:inputText id="name" value="!CustomerFirstName}" styleClass="dropdown1"</apex:inputText>

I have tried the rendered attribute as given in the developerforce document (link below) and an example which I have tried.
http://wiki.developerforce.com/page/Enforcing_CRUD_and_FLS
Eg.,
<apex:inputText  id="name"  value="!CustomerFirstName}"  styleClass="dropdown1"
                    rendered="{!$ObjectType.Appointment__c.Fields.Customer_Name__c.createable}" >
</apex:inputText>

I am using Apex property in the controller for some reason, hence inputText in the VF page.

Is there any way on how to overcome this issue using apex:inputText only(but not apex:inputField) in the page.
Any help will be highly appreciated.

Regards,
Nisar Ahmed

Hi All,

 

I have 2 custom objects by name 'Customer__c' and 'Address__c'.

Address object has a look up field of customer. It also has a picklist field 'Type__c' with values 'Primary' and 'Secondary' indicating the primary and secondary addresses for the customer object.

 

Now I want to restrict the customer to have only one 'Primary' address record but it can have multiple 'Secondary' address records. 

 

I have written the following trigger to accomplish this.

trigger primaryAddressDupPreventionV2 on Address__c (before insert, before update) {

	List<Address__c> Addr_List = new List<Address__c>();
	
	List<Address__c> addr_temp = System.Trigger.new;
    Customer__c cust = [select Id,Name from Customer__c where id=:addr_temp[0].Customer__c];

	try{
		for (Integer i=0;i<trigger.new.size();i++) {
			Addr_list = [Select Id, Name, Customer__c, Type__c from Address__c 
		                                where Customer__c =: cust.Id and Address__c.Type__c = 'Primary' and Id != null limit 1];
			system.debug('Addr List Size: '+Addr_list.size());
			system.debug('Addr List: '+Addr_list);
			
			if(Addr_List.size()== 0 && trigger.new[i].Type__c == 'Secondary'){
				trigger.new[i].Type__c.addError('Primary Address does not exist');
			}
			if(trigger.isInsert && Addr_List.size()>0 && Addr_List.get(0).Type__c == 'Primary' && trigger.new[i].Type__c == 'Primary'){
				trigger.new[i].Type__c.addError('Only one Primary Address should exist');
			}
		}
	}catch (DmlException e1) {
     	System.debug(e1.getMessage() );     
    }catch (TypeException e2) {
     	System.debug(e2.getMessage() );     
    }
}

 The trigger is working fine while inserting records. But fails during update operation.

 

Could anyone please let me know where I have gone wrong or any workaround to accomplish the same.

Any help will be highly appreciated.

Hi All,

 

I have a custom object by name 'Portfolio__c'. I have a picklist field 'Status_c' with values 'New' and 'Activated'.

When the record is first created the Status value is New. 

After 30 minutes of the record creation, I need to update the Status to Activated automatically.

 

I have written the following trigger, but still not able to update the field.

trigger portfolioAfterInsertAfterUpdate on Portfolio__c (after insert, after update) {

	List<Portfolio__c> Pfs = new List<Portfolio__c>();
	for (Integer i=0;i<trigger.new.size();i++) {	
		Pfs = [Select Name, Status__c, CreatedDate, Id from Portfolio__c where Status__c =: 'New' limit 1];	
	    if(Pfs.size() > 0 && Pfs.get(0).Status__c == 'New'){
	    	Datetime dt = Pfs.get(0).CreatedDate;
	    	dt = dt.addMinutes(30);
	    	if(dt == system.now()){
		    	Portfolio__c pf = new Portfolio__c(id=Pfs.get(0).id, Status__c = 'Activated');
		        update pf;
	    	}
	    }
	}
}

Could you please tell me where I have gone wrong or any work around to do the same.

Any help will be highly appreciated.

 

Hi All,

 

I have a inputText field in a VF page and I need to disable paste function(Ctrl+v and paste using mouse button) so that we need to compulsorily type in the text box instead of just copy pasting.

 

I have tried the following script:

<script>

function DisableCtrlKey(e)
{
    var code = (document.all) ? event.keyCode:e.which;
    // look for CTRL key press
    if (parseInt(code)==17)
    {
        alert("Please re-type your email address");
        window.event.returnValue = false;
    }
}

function DisableRightClick(event)
{
    //For mouse right click
    if (event.button==2)
    {
        alert("Please re-type your email address");       
    }
}

</script>

 and under the VF page:

<apex:inputText id="confirmemail" value="{!email}" onKeyDown="return DisableCtrlKey(event)" onMouseDown="DisableRightClick(event)" </apex:inputText>

 It works fine but I want to implement the same functionality without using alert function.

 

Can anyone please let me know any work around to accomplish the above scenario.

Any help on this will be highly appreciated.

 

 

 

Hi,

 

I have 2 custom objects 'Parent__c' and 'Child__c'. Have created a look up on parent object.

I have created a VF page containing fields of both the objects. Now, I need to create one Parent object record and multiple child records(say 2-5 records with different user input data for each child record) associated with the parent record in one shot when I click on 'Save' button.

 

Please let me know if you have any idea or work around to accomplish the above scenario.

Any help on this will be highly appreciated.

Hi,

 

I have two custom objects 'Contact__c' and 'Gift_Aid__c' where a Contact object can have multiple Gift Aid records.

A look up relation has been created from 'Gift_Aid__c' on 'Contact__c'.

 

I have  a VF page where I am using the fields of both the objects. When I save the page, a Contact and a Gift Aid record associated with the contact needs to be created.

 

Can anyone please provide me a sample controller code for the above scenario.

 

Any help regarding this will be highly appreciated.

 

 

Hi All,

 

I need to display an custom validation error message for an 'inputText' field.

For Example:

Here, I need to display an error message if the inputText for 'Name' is null or empty.

 

<div style="position:absolute; top: 145px; left: 30px;" class="cnt_popup">
Name: 
</div>
<div style="position:absolute; top: 140px; left: 105px; height:20px; width:200px;" >
     <apex:inputText id="name" value="{!Name}" styleClass="textarea" required="true">                                    
     </apex:inputText>  
</div>

 Please let me know if you have any idea about how to display an custom validation error message.

Hi All,

 

I need to display an custom validation error message for an 'inputText' field.

For Example:

Here, I need to display an error message if the inputText for 'Name' is null or empty.

 

<div style="position:absolute; top: 145px; left: 30px;" class="cnt_popup">
Name: 
</div>
<div style="position:absolute; top: 140px; left: 105px; height:20px; width:200px;" >
     <apex:inputText id="name" value="{!Name}" styleClass="textarea" required="true">                                    
     </apex:inputText>  
</div>

 Please let me know if you have any idea about how to display an custom validation error message.

 

Hi All,

 

I have two VF pages 'A' and 'B'.

Page 'A' contains a textbox and 'Search' button, on clicking 'Search' button it directs us to Page 'B' with the search string as a parameter.

Page 'B' contains a 'Go Back' button, on clicking 'Go Back' button it redirects us back to Page 'A' with the same search string as a parameter. I am even able to pass that string in the textbox present in Page 'A'.

 

Problem:

After passing the string to the textbox, I am unable to click the 'Search' button or (submit the form) so that i can get back the search results when we click on the 'Go Back' button on page 'B'.

Here is the script that I have written on Page 'A' :

 

/* Script code */
function gup( name )
{
        name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
        var regexS = "[\\?&]"+name+"=([^&#]*)";
        var regex = new RegExp( regexS );
        var results = regex.exec( window.location.href );
        if( results == null )
            return "";
        else
            return results[1];
}

function Submitfunction()
{
        var btnSubmitTags = document.getElementById('j_id0:form1:searchsubmit');
        var store_str = gup( 'StoreSearch' );
        oFormObject = document.forms['j_id0:form1'];
        oFormElement = oFormObject.elements['addressInput'];
        if(store_str.length > 0){
            oFormElement.value = store_str;
        }
        btnSubmitTags.click();

}
/* Script code */

 Please let me know if you have any idea about this problem or where I have went wrong.

 

 

Hi All,

 

I have two VF pages 'A' and 'B'.

Page 'A' contains a textbox and 'Search' button, on clicking 'Search' button it directs us to Page 'B' with the search string as a parameter.

Page 'B' contains a 'Go Back' button, on clicking 'Go Back' button it redirects us back to Page 'A' with the same search string as a parameter.

 

Problem:

When I click on 'Go Back' button on Page 'B', I need to pass that search string in the textbox and click on 'Search' button automatically(or onload).

 

Please let me know if you any ideas to solve this problem or bug.

Hi All,

 

I want to pass 2 parameters 'ID' and 'stringvalue' from VF page 'A'  to VF page 'B'.

And again i want to retrieve back those parameters from page 'B' to page 'A'.

 

Please let me know if you have any idea or suggestion or simple example for this scenario.

 

Hi All,

 

I have 2 VF pages :

'Locator' and 'TimeAvail'.

 

'Locator' page contains a text box and search button, where we enter a value in text box and click on 'Search' button resulting in a list of results. Upon clicking one of the search result, it directs us to the 'TimeAvail' page.

 

Now the 'TimeAvail' page contains a 'Go Back' button. On clicking this 'Go Back' button, it redirects us back to 'Locator' page.

 

Problem:

'Go Back' button just redirects to the 'Locator' page. But, I want the 'Go Back' button to redirect to 'Locator' page and should also retain the search results that we got earlier in the 'TimeAvail' page upon entering a value in text box and clicking on 'Search' button. 

 

I have stuck here. Please let me know if you have any idea or information to solve this.

 

 

Thanks and Regards,

Nisar Ahmed

 

Hi All,

I am unable to overcome the error 'inputText_Ignoring_FLS' for the below statement which I have used in a VF page.
<apex:inputText id="name" value="!CustomerFirstName}" styleClass="dropdown1"</apex:inputText>

I have tried the rendered attribute as given in the developerforce document (link below) and an example which I have tried.
http://wiki.developerforce.com/page/Enforcing_CRUD_and_FLS
Eg.,
<apex:inputText  id="name"  value="!CustomerFirstName}"  styleClass="dropdown1"
                    rendered="{!$ObjectType.Appointment__c.Fields.Customer_Name__c.createable}" >
</apex:inputText>

I am using Apex property in the controller for some reason, hence inputText in the VF page.

Is there any way on how to overcome this issue using apex:inputText only(but not apex:inputField) in the page.
Any help will be highly appreciated.

Regards,
Nisar Ahmed

Hi All,

 

I have 2 custom objects by name 'Customer__c' and 'Address__c'.

Address object has a look up field of customer. It also has a picklist field 'Type__c' with values 'Primary' and 'Secondary' indicating the primary and secondary addresses for the customer object.

 

Now I want to restrict the customer to have only one 'Primary' address record but it can have multiple 'Secondary' address records. 

 

I have written the following trigger to accomplish this.

trigger primaryAddressDupPreventionV2 on Address__c (before insert, before update) {

	List<Address__c> Addr_List = new List<Address__c>();
	
	List<Address__c> addr_temp = System.Trigger.new;
    Customer__c cust = [select Id,Name from Customer__c where id=:addr_temp[0].Customer__c];

	try{
		for (Integer i=0;i<trigger.new.size();i++) {
			Addr_list = [Select Id, Name, Customer__c, Type__c from Address__c 
		                                where Customer__c =: cust.Id and Address__c.Type__c = 'Primary' and Id != null limit 1];
			system.debug('Addr List Size: '+Addr_list.size());
			system.debug('Addr List: '+Addr_list);
			
			if(Addr_List.size()== 0 && trigger.new[i].Type__c == 'Secondary'){
				trigger.new[i].Type__c.addError('Primary Address does not exist');
			}
			if(trigger.isInsert && Addr_List.size()>0 && Addr_List.get(0).Type__c == 'Primary' && trigger.new[i].Type__c == 'Primary'){
				trigger.new[i].Type__c.addError('Only one Primary Address should exist');
			}
		}
	}catch (DmlException e1) {
     	System.debug(e1.getMessage() );     
    }catch (TypeException e2) {
     	System.debug(e2.getMessage() );     
    }
}

 The trigger is working fine while inserting records. But fails during update operation.

 

Could anyone please let me know where I have gone wrong or any workaround to accomplish the same.

Any help will be highly appreciated.

Hi All,

 

I have a custom object by name 'Portfolio__c'. I have a picklist field 'Status_c' with values 'New' and 'Activated'.

When the record is first created the Status value is New. 

After 30 minutes of the record creation, I need to update the Status to Activated automatically.

 

I have written the following trigger, but still not able to update the field.

trigger portfolioAfterInsertAfterUpdate on Portfolio__c (after insert, after update) {

	List<Portfolio__c> Pfs = new List<Portfolio__c>();
	for (Integer i=0;i<trigger.new.size();i++) {	
		Pfs = [Select Name, Status__c, CreatedDate, Id from Portfolio__c where Status__c =: 'New' limit 1];	
	    if(Pfs.size() > 0 && Pfs.get(0).Status__c == 'New'){
	    	Datetime dt = Pfs.get(0).CreatedDate;
	    	dt = dt.addMinutes(30);
	    	if(dt == system.now()){
		    	Portfolio__c pf = new Portfolio__c(id=Pfs.get(0).id, Status__c = 'Activated');
		        update pf;
	    	}
	    }
	}
}

Could you please tell me where I have gone wrong or any work around to do the same.

Any help will be highly appreciated.

 

Hi All,

 

I have a inputText field in a VF page and I need to disable paste function(Ctrl+v and paste using mouse button) so that we need to compulsorily type in the text box instead of just copy pasting.

 

I have tried the following script:

<script>

function DisableCtrlKey(e)
{
    var code = (document.all) ? event.keyCode:e.which;
    // look for CTRL key press
    if (parseInt(code)==17)
    {
        alert("Please re-type your email address");
        window.event.returnValue = false;
    }
}

function DisableRightClick(event)
{
    //For mouse right click
    if (event.button==2)
    {
        alert("Please re-type your email address");       
    }
}

</script>

 and under the VF page:

<apex:inputText id="confirmemail" value="{!email}" onKeyDown="return DisableCtrlKey(event)" onMouseDown="DisableRightClick(event)" </apex:inputText>

 It works fine but I want to implement the same functionality without using alert function.

 

Can anyone please let me know any work around to accomplish the above scenario.

Any help on this will be highly appreciated.

 

 

 

Hi,

 

I have two custom objects 'Contact__c' and 'Gift_Aid__c' where a Contact object can have multiple Gift Aid records.

A look up relation has been created from 'Gift_Aid__c' on 'Contact__c'.

 

I have  a VF page where I am using the fields of both the objects. When I save the page, a Contact and a Gift Aid record associated with the contact needs to be created.

 

Can anyone please provide me a sample controller code for the above scenario.

 

Any help regarding this will be highly appreciated.

 

 

Hi All,

 

I need to display an custom validation error message for an 'inputText' field.

For Example:

Here, I need to display an error message if the inputText for 'Name' is null or empty.

 

<div style="position:absolute; top: 145px; left: 30px;" class="cnt_popup">
Name: 
</div>
<div style="position:absolute; top: 140px; left: 105px; height:20px; width:200px;" >
     <apex:inputText id="name" value="{!Name}" styleClass="textarea" required="true">                                    
     </apex:inputText>  
</div>

 Please let me know if you have any idea about how to display an custom validation error message.

 

I have a Visualforce page which uses standard controller and controller Extensions, I want to dispaly a Custom Validation Error message on the VF page. Any ideas!

Hi All,

 

I have two VF pages 'A' and 'B'.

Page 'A' contains a textbox and 'Search' button, on clicking 'Search' button it directs us to Page 'B' with the search string as a parameter.

Page 'B' contains a 'Go Back' button, on clicking 'Go Back' button it redirects us back to Page 'A' with the same search string as a parameter.

 

Problem:

When I click on 'Go Back' button on Page 'B', I need to pass that search string in the textbox and click on 'Search' button automatically(or onload).

 

Please let me know if you any ideas to solve this problem or bug.

Hi All,

 

I have 2 VF pages :

'Locator' and 'TimeAvail'.

 

'Locator' page contains a text box and search button, where we enter a value in text box and click on 'Search' button resulting in a list of results. Upon clicking one of the search result, it directs us to the 'TimeAvail' page.

 

Now the 'TimeAvail' page contains a 'Go Back' button. On clicking this 'Go Back' button, it redirects us back to 'Locator' page.

 

Problem:

'Go Back' button just redirects to the 'Locator' page. But, I want the 'Go Back' button to redirect to 'Locator' page and should also retain the search results that we got earlier in the 'TimeAvail' page upon entering a value in text box and clicking on 'Search' button. 

 

I have stuck here. Please let me know if you have any idea or information to solve this.

 

 

Thanks and Regards,

Nisar Ahmed

 

Hi,

 

Any body help me!...

 

HOw to get Validation errors on VFPage?

 

Thank U

 

 

 

 

I am trying to deploy one class which has implemented Schedulable interface.

But when I try to deploy it using ANT I am getting the following error :

"Schedulable class has jobs pending or in progress".

 

I am waiting for this to get resolved since more than 48 hrs and it doesn't seem to resolve.

What can be done in such case? How to deploy it to production? I tried to deploy by making packages but could not since the components in the package already exist in production and gives an error when I unzip the package. Please suggest what can be done in this situation.

  • March 26, 2010
  • Like
  • 0