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.

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?

| improve this answer | |
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' }"
| improve this answer | |
  • I copied pasted that. doesn't fix my issue. – J. Zhang Jun 15 '17 at 18:45
  • Maybe copy paste is the issue. Can you manually type it – RedDevil Jun 15 '17 at 18:46
  • yep. still an issue. also it should be sObjectType right? – J. Zhang Jun 15 '17 at 19:10
  • and its not affecting any of my other ui inputfields that call cObj – J. Zhang Jun 15 '17 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}"/>  
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.