• sbrmath
  • NEWBIE
  • 0 Points
  • Member since 2009

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

target="_blank" is not working with rerendered attribute for CommandLink.

It is not spawning a new window as expected, the results are displayed in the current browser window.

If i remove rerendered, clicking on the link spawns the new window.

 

Is this a known issue? is there a workaround for this?

 

<apex:commandLink rendered="{!result.isXYZAccount == 'NO-ADD'}" value="{!result.isXYZAccount}" action="{!loadGuest}" target="_blank" rerender="abc,xyz"/>

 

Here is the code... 
*****page ****
<apex:commandLink rendered="{!result.isXYZAccount == 'NO-ADD'}" value="{!result.isXYZAccount}" action="{!loadGuest}"  rerender="searchResultsPB,errorPanel" />
<apex:actionSupport event="onclick" action="{!disableButtons}" rerender="searchResultsPB,errorPanel"/>
 
***controller****
 public PageReference loadGuest() {
     PageReference pageref = null;
        String winetid = getRequestWINetID();
        String statusCode = '1';
        AccountDisplay accountDisplayFromResults = null;
        Account a;
        
        if(results != null) {
            for(AccountDisplay acc : results) {
                if(acc != null && acc.account != null && acc.account.i_winet_id__c == winetid) {
                    System.debug('Found my AccountDisplay Object');
                    accountDisplayFromResults = acc;
                    break;
                }
            }
            if(accountDisplayFromResults != null) {
                a = GuestLoadRequester.LoadGuest(accountDisplayFromResults.account, baseurl);
                if(a != null && a.Id != null) {
                    System.debug('Inserted Account has id: ' + a.Id);
                    accountDisplayFromResults.id = a.id;
                    accountDisplayFromResults.isSMARTAccount = 'YES';
                    accountDisplayFromResults.Account = a;
                    pageref = new PageReference('/' + a.id);
                } else if (a != null) { // a is not in smart database
statusCode = '2';                
                }
            }
        }
        
        if(pageref == null) {
         pageref = new PageReference('/apex/GuestLoadStatus?winetid=' + winetid + '&status=' + statusCode);
        }
        return pageref;
    } 
 
The goal is to spawn a new window when i click on the link created by CommandLink and at the same time refresh the parent page.
I have tried putting target=_blank for commandLink and it does not work(does not spawn new window), am i missing something? 

How can i make the radio button as well as label for the radio button clickable?

 

Code:

        <apex:outputLabel value=""/> 

              

        <table border="0">   

         

        <tr>

            <td> 

                 <apex:selectRadio id="searchType" layout="pageDirection" disabled="true" value="{!searchType}" onclick="setSearchType(this);" styleClass="radio_b">

                 <apex:selectOptions value="{!items}"/>

                 </apex:selectRadio>                

            </td>

        </tr>

        

        </table> 

Is it possible to display link based on certain condition on the page itself?

 

Here is what i want to to

If (condition) {

<apex:outputLink value="/{!result.account.Id}" target="_parent"> {!result.account.FirstName + ' ' + result.account.LastName} </apex:outputLink>

 

} else {

<apex:outputtext value="{!result.account.FirstName + ' ' + result.account.LastName}"/>

 

}

condition  is based on value in another variable on the page.

 

What is the exact syntax for if on the visualforce page? 

Here is the code snippet 

acc.c_prop_cd__c = guestMatch.Prop

 

c_prop_cd__c is  a reference varaible & Prop is value i am getting from a web service callout.

 

I am getting  System.StringException: Invalid id error.

 

is there something i should do to assign value to a reference variable? 

target="_blank" is not working with rerendered attribute for CommandLink.

It is not spawning a new window as expected, the results are displayed in the current browser window.

If i remove rerendered, clicking on the link spawns the new window.

 

Is this a known issue? is there a workaround for this?

 

<apex:commandLink rendered="{!result.isXYZAccount == 'NO-ADD'}" value="{!result.isXYZAccount}" action="{!loadGuest}" target="_blank" rerender="abc,xyz"/>

 

Here is the code... 
*****page ****
<apex:commandLink rendered="{!result.isXYZAccount == 'NO-ADD'}" value="{!result.isXYZAccount}" action="{!loadGuest}"  rerender="searchResultsPB,errorPanel" />
<apex:actionSupport event="onclick" action="{!disableButtons}" rerender="searchResultsPB,errorPanel"/>
 
***controller****
 public PageReference loadGuest() {
     PageReference pageref = null;
        String winetid = getRequestWINetID();
        String statusCode = '1';
        AccountDisplay accountDisplayFromResults = null;
        Account a;
        
        if(results != null) {
            for(AccountDisplay acc : results) {
                if(acc != null && acc.account != null && acc.account.i_winet_id__c == winetid) {
                    System.debug('Found my AccountDisplay Object');
                    accountDisplayFromResults = acc;
                    break;
                }
            }
            if(accountDisplayFromResults != null) {
                a = GuestLoadRequester.LoadGuest(accountDisplayFromResults.account, baseurl);
                if(a != null && a.Id != null) {
                    System.debug('Inserted Account has id: ' + a.Id);
                    accountDisplayFromResults.id = a.id;
                    accountDisplayFromResults.isSMARTAccount = 'YES';
                    accountDisplayFromResults.Account = a;
                    pageref = new PageReference('/' + a.id);
                } else if (a != null) { // a is not in smart database
statusCode = '2';                
                }
            }
        }
        
        if(pageref == null) {
         pageref = new PageReference('/apex/GuestLoadStatus?winetid=' + winetid + '&status=' + statusCode);
        }
        return pageref;
    } 
 
The goal is to spawn a new window when i click on the link created by CommandLink and at the same time refresh the parent page.
I have tried putting target=_blank for commandLink and it does not work(does not spawn new window), am i missing something? 

How can i make the radio button as well as label for the radio button clickable?

 

Code:

        <apex:outputLabel value=""/> 

              

        <table border="0">   

         

        <tr>

            <td> 

                 <apex:selectRadio id="searchType" layout="pageDirection" disabled="true" value="{!searchType}" onclick="setSearchType(this);" styleClass="radio_b">

                 <apex:selectOptions value="{!items}"/>

                 </apex:selectRadio>                

            </td>

        </tr>

        

        </table> 

Is it possible to display link based on certain condition on the page itself?

 

Here is what i want to to

If (condition) {

<apex:outputLink value="/{!result.account.Id}" target="_parent"> {!result.account.FirstName + ' ' + result.account.LastName} </apex:outputLink>

 

} else {

<apex:outputtext value="{!result.account.FirstName + ' ' + result.account.LastName}"/>

 

}

condition  is based on value in another variable on the page.

 

What is the exact syntax for if on the visualforce page? 

Here is the code snippet 

acc.c_prop_cd__c = guestMatch.Prop

 

c_prop_cd__c is  a reference varaible & Prop is value i am getting from a web service callout.

 

I am getting  System.StringException: Invalid id error.

 

is there something i should do to assign value to a reference variable?