0
   <aura:attribute name="cObj" access="global" type="Case" default="{'sObjectType':'Case'}"/>

                        <force:inputField aura:id="reqType" value="{!v.cObj.Type}"></force:inputField>

I get this error when loading this app with this component.

Aura.loadComponent(): Failed to initialize application.

Deleting the force:inputfield makes the page load properly.

Confused about why this doesn't seem to work at all for me. Doesn't matter what field I tried. Read the api and done other research, seeing if i'm missing some syntax or something obvious and couldn't find the issue.

Any help would be appreciated.

0

3 Answers 3

3

So, the issue is not the spacing. JSON doesn't care about spacing.

The issue is that you have used sObjectType rather than sobjectType

Change

default="{ 'sObjectType': 'Case' }"

To:

default="{ 'sobjectType': 'Case' }"

Notice the capitalization change?

0

The issue is in your default value for the attribute 'cObj'. the spacing inside curly braces is not there in your attribute thats what is breaking

default="{ 'sobjectType': 'Case' }"
4
  • I copied pasted that. doesn't fix my issue.
    – J. Zhang
    Commented Jun 15, 2017 at 18:45
  • Maybe copy paste is the issue. Can you manually type it
    – RedDevil
    Commented Jun 15, 2017 at 18:46
  • yep. still an issue. also it should be sObjectType right?
    – J. Zhang
    Commented Jun 15, 2017 at 19:10
  • and its not affecting any of my other ui inputfields that call cObj
    – J. Zhang
    Commented Jun 15, 2017 at 19:46
0

Just try the same as below:

<aura:attribute name="cObj" type="Case" default="{ 'sobjectType': 'Case' }"/>
<force:inputField aura:id="reqType" value="{!v.cObj.Type}"/>  

You must log in to answer this question.

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