0

I have lightning component which displays account details, I added that component in a VF page which has select button. Here I want to display error message if nothing is selected.

So I am facing issue to bring check box value into VF page Apex controller

Lightning component Acccomponent:

<aura:component controller="accController" implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes" 
                access="global">


    <aura:attribute name="checked" type="String[]" />


    <tr >
        <td >
                    <div class="uiInput uiInputCheckbox uiInput--default uiInput--checkbox">
                    <label class="slds-checkbox">                

                        <ui:inputCheckbox aura:id="checkboxMCN" text="{!v.acc.Id}" value=""  class="sq-25 checkbox checkbox--defa   ult checkbox--states-1 brm mrs bg-secondary-btn sq-22 a-mid dib" updateOn="change,click"  change="{!c.onCheck}" />
                        <span class="slds-assistive-text">Select row CDH Account</span>
                    </label>
                    </div>

                </td></tr>
                // remaining code

                </aura:component>

VF page :



<script>

        var accountId = "{!$CurrentPage.parameters.id}";
    $Lightning.use("c:AcccomponentApp", function() {
        $Lightning.createComponent("c:Acccomponent",
                                   {"accountId" : accountId}, 
                                   "lightning"

        );
    });
</script>         

   </apex:pageBlockSection> 
 <apex:pageblockButtons >     
       <apex:commandButton value="SelectAcc" id="Select"  styleClass="hideButton"  action="{!goToAccpage}" />

 </apex:pageblockButtons>  
  <apex:pageMessages />
</apex:PageBlock>  

selAccCOntroller:

public PageReference selmethod()
    {

        //This query will return selected value
        List<selected__c> uscpq = [select Id,Account_ID__c from selected__c order by createddate desc limit 1];

        PageReference pr = new PageReference('/apex/pageval');
        return pr;
    }

1 Answer 1

1

Sounds like you're trying to do something like this:

https://developer.salesforce.com/blogs/developer-relations/2017/01/lightning-visualforce-communication.html

1
  • Good one there! I believe these scenarios are for a VF page wrapped in a lightning component. Would that work the other way around? i.e. ltng component wrapped in an iframe in a VF page? Have you tried it? Commented Jul 28, 2017 at 18:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .