2

I have a created a Lightning App having 2 Components -

  1. Login Page
  2. Registration Page

After Logging in (One Time Login) the Sales person is taken to Registration Page. The event participants are then handed over the IPAD to fill in there details on Registration form. The Submit button on Registration page Saves data into Salesforce and refreshes the registration page. So the IPAD is then handed over to next participant and so on.

This functionality is working perfectly fine if I access the App using the lightning URL. Now I have to add the app to Salesforce1 Navigation menu. I added both components as Lightning Component Tabs and added them to Salesforce1 Mobile Navigation Menu. However When I click on Login button the control does not navigate to the Registration Page. Below is the code I have written for form navigation:-

App Event Handler

The Event Handler is defined in The App as -

event="c:navigateToForm" action="{!c.navigateToForm}"

AppController.js - Contains method to navigate to Registration form

navigateToForm : function(component, event, helper) {
    console.log("Inside Navigate To Form method forming URL>>>>>>>>>>>>>>>>>");
    var dest = "markup://c:" + event.getParam("view") + "Form";
    console.log("event.getParam>>>>>>>>>>>>>>>>>" + event.getParam("view"));
    $A.componentService.newComponentAsync(this, function(view) {
        console.log("Inside Navigate To Form method >>>>>>>>>>>>>>>>>");
        console.log("Hellooooooooooooooooooooo");
        console.log("!v.presName  >>>>>>>>>>>" + component.get("v.presName"));
        var content = component.find("content");

        content.set("v.body", view);
        //component.set("v.body", "Hello World!");
    },  {
        componentDef: dest,
        attributes: {
            values: {
                presName: "{!v.presName}",
                presDate: "{!v.presDate}",
                evtName: "{!v.evtName}"
            }
        }
    }, component);
}

Button:- Inside the Login Component Login Button calls c.gotoForm method which then calls the event to navigate to Registration Form.

<aura:component controller="loginFormController" access="global" implements="force:appHostable">
    <ui:button class="btn-xlarge" label="Login" press="{!c.gotoForm}"/>
</aura:component>

gotoForm Method:-

gotoForm : function(component, event, helper) {
        console.log("Navigating to Regitration Form >>>>>>>>>>>>>>>>>");
        //helper.getUserDetails(component);
        var evt = $A.get("e.c:navigateToForm");
        console.log("Navigating to Regitration Form 111111111111111>>>>>>>>>>>>>>>>>");
        /*evt.setParams({
            componentDef: "c:registrationForm"
       });*/
        console.log("Navigating to Regitration Form 333333333333333>>>>>>>>>>>>>>>>>");
       //evt.fire();
       evt.setParams({view: "registration"}).fire();
       component.set("v.showLogin",false);
        component.set("v.loggedIn",true);
    }

navigateToForm Event:-

<aura:event type="APPLICATION" >
    <aura:attribute name="view" type="String" required="true"/>
</aura:event>

The control goes till the "Navigating to Regitration Form 333333333333333>>>>>>>>>>>>>>>>>"

Am I missing something here? How can I make the app accessible through Salesforce1? What I understand here is the system is unable to find the navigateToForm Event. How can I resolve this issue?

Thanks

3
  • Just an edit - The navigateToForm method (added in edited post above) in AppController.js is not visible to the login controller as there is no option to add Lightning app to Salesforce1. This method replaces the body of app (Login Page) with Registration Page.
    – Vandana
    Commented Mar 20, 2015 at 4:37
  • Why are you attempting a login? Logging into what? If you're in S1 mobile the salesperson would already be logged in. I think you only need the tab for the registration page, unless I am misunderstanding.
    – pchittum
    Commented Mar 22, 2015 at 0:02
  • Peter the login page is used by the sales people to select Event Type. So they select Event Type, Date of event and then control has to move to Registration oage where they hand on the IPAD to attendees.
    – Vandana
    Commented Mar 22, 2015 at 23:09

0

You must log in to answer this question.