• shubham lathoriya
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hello Folks,

I was facing an issue with my loading  of visualforce page. I have executed the javascript, from the javascript iam executing action method. After executing that action method, again my page is reloading but i just want to stop after execution of action method.

In the end of my action method the below code is executing correctly::
if(prdctsWithQuantity.size()>0){
              currentStep='2';  
 }

VF Page:
<script type="text/javascript">
        function showRelatedProducts(slctrcrd){
             var eterm=document.getElementById('{!$Component.frm:pb0:pblksctn:pbsitm:pfmly}').value;
              if(eterm=='')
              {
                  alert('You have to Select Product Family');
              }
              else{
                     callprdcts();
              }
    }
</script>
  <apex:actionFunction action="{!showSelectedProductFamilyRecords}" name="callprdcts" reRender="frm"/>

Actually it is showing the second step page, but again coming back to first step page. How to stop after the above logic execution..

Suggest me, Thanks in advance !!

Hi All,

Firstly, thanks for taking the time to read my post.

I have a vg page that has an actionFunction that calls an apex method from my custom controller. After running, there are a few components that are supposed to reload. However, what's happening is as follows:

1. The page starts to reload.

2. The apex method is called.

3. The components are NOT rerendered.

Does anyone have any ideas as to why that would happen?

Here is the relevant code:

1. ActionFunction tag:

  <apex:actionFunction name="undoEdit" action="{!undoEdit}" rerender="taskInfoDisplay, descInfo,fundraisingInfo, sysInfo,editButtons">
  <apex:param name="fieldToRollBack" value="{!fieldToRollBack}"/>
  </apex:actionFunction>

 

 

2. VF code that calls it:

 

<apex:commandButton image="xxx" onclick="undoEdit('Priority')" rendered="{!editState['Priority']}"/>

 

 

3. Apex Method:

 

public void undoEdit(){
		fieldToRollBack = ApexPages.currentPage().getParameters().get('fieldToRollBack');
		System.debug('the field is:' +  fieldToRollBack );
		//first check if this was edited
		if(editState.get(fieldToRollBack)){
			System.debug('the field was changed');
			if(origTaskVals.containsKey(fieldToRollBack)){
				System.debug('this is a task field, rolling back. The current val: ' + myTask.get(fieldToRollBack) + '. The orig val: ' + origTaskVals.get(fieldToRollBack));
				myTask.put(fieldToRollBack,origTaskVals.get(fieldToRollBack));
				System.debug('after putting, the val is: ' + myTask.get(fieldToRollBack))	;
			}
			
			editState.put(fieldToRollBack, false);
			
		}
	
	}

 

Thanks in advance for your help!

 

  • March 28, 2011
  • Like
  • 0