I am not able to see my lightning component when trying to create a lighting tab. Something is wrong with one of the components -
I moved the component and tab using salesforce dx and when editing the component. I am getting below error. I seems like one of the component is throwing an error when i am trying to edit the record -
Error = Review all error messages below to correct your data.
You can only create lightning tabs for AuraDefinitionBundles containing a component that implements force:appHostable and has no required attributes without a default value. (Related field: Content)
Observation - When i remove the attribute from parent component and child component than its working and i am able to save the tab. Something is not correct with my component initiation.
Code in parent Component -
<aura:if isTrue="{!!v.customTab}">
<div aura:id="defaultTabContent" class="slds-show">
<c:ApiRequestFieldMapping custom="false" objectName="Credit_Report__c"/>
</div>
</aura:if>
<aura:if isTrue="{!v.customTab}">
<div aura:id="customTabContent" class="slds-hide">
<c:ApiRequestFieldMapping custom="true" listSObjects="
{!v.listSObjects}" message="Select object from drop-down."
messageClass="Info"/>
</div>
Code in Child Component -
<aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
<aura:registerEvent name="handleModelVisiblity" type="c:HandleModel"/>
<!-- attributes -->
<aura:attribute name="custom" type="Boolean"/>
<aura:attribute name="objectName" type="String"/>
<aura:attribute name="listSObjects" type="String[]"/>
<aura:attribute name="message" type="String"/>
<aura:attribute name="messageClass" type="String"/>
<aura:attribute name="listSObjectFields" type="String[]"
required="false"/>
<aura:attribute name="customObjectName" type="String"
required="false"/>
<aura:attribute name="listWrapper"
type="RequestMappingWrapper.MappingRecords[]" required="false"/>
Already Tried - 1. My component is already implementing "force:appHostable" interface.
2. The component us using latest version.(40.0)
3. Have already tried creating the components.
4. My org has my domain enabled and also have namespace.
I have fixed the issue. I have removed the reference to inner class in one of the attribute. Changed "RequestMappingWrapper.MappingRecords[]" to "RequestMappingWrapper[]".
Related
Hi I'm new to salesforce. I'm trying to develop a lightning component that will take user input, process that input & will display the value in two text box.My lightning component looks like
<aura:component implements="flexipage:availableForAllPageTypes,force:appHostable" access="global" controller="VisionController">
<!--Remember to define your binding attribute-->
<aura:attribute name="val" type="String"/>
<lightning:card title="Partner Information">
<div class="slds-p-around_medium">
<p>
<!--Set you attribute as the value of the lightning:input component-->
<lightning:input aura:name="val"
label ="Enter KPI"
value="{!v.val}"
type="text"
onchange="{!c.onChange}"/>
</p>
</div>
</lightning:card>
My JS controller looks like
({
onChange : function(component, event, helper) {
var action = component.get("c.getCallKPI")
action.setParams({
"value":val,
})
$A.enqueueAction(action)
}
})
I tried to do the iteration portion in controller using following code
var prediction=component.find("pred")
var predictionProb=component.find("predProb")
<aura:iteration items="{c.getCallKPI}" var="predUrl" >
prediction.value="{!predUrl.label}"
predictionProb.value="{!prediction.probability}"
</aura:iteration>
where prediction & predictionProb are id of two lightning inputs given in my component.But I'm getting syntax error at </aura:iteration>
If I'm doing it in component using following code
<aura:iteration items="{c.getCallKPI}" var="predUrl" >
<lightning:input id="pred" readonly="true" value="{!predUrl.label}"/>
<lightning:input id="predProb" readonly="true" value="{!predUrl.probability}" />
</aura:iteration>
Then it's not giving any error but not populating the inputs.
Can you guide how do I resolve this?
my getCallKPI is given below
#auraEnabled
public static List<KPI.Prediction> getCallKPI(string value) {
return KPI.Prediction;
}
You should use aura:iteration inside component markup.
In your component create new attribute of type "List".
<aura:attribute name="predictions" type="List"/>
In JS controller specify callback for action, in which set new attribute to response.getReturnValue().
action.setCallback(this, function(response) {
component.set("v.predictions", response.getReturnValue());
}
Calling a Server-Side Action
Inside component, iterate over returned records:
<aura:iteration items="{!v.predictions}" var="item">
//your logic
</aura:iteration>
aura:iteration
When the form is initially loaded the multicombo on the form correctly reflects the data that is set up.
However, if I attempt to update the information at runtime, the list of options in the multicombo aren't updated when the form is displayed.
I have them successfully defined as form options, they have a simple 'text' only store. However, I can't seem to find the correct set of properties and method to actually update the multicombo from the C# code as needed.
I've noticed this as well. You can set the Ext.net.ListItems on page-load but they are fickle when it comes to setting them dynamically in code-behind. I now always use a Ext.net.Store with any Multicombo or ComboBox that needs to dynamically change.
You can use the Handler events on Focus or BeforeSelect to reload the list.
<ext:ComboBox ID="ComboBoxTransferGroupMembers" runat="server" FieldLabel="Transfer To" EmptyText="Group Members" LabelAlign="Top" DisplayField="Name" ValueField="Id" MarginSpec="0 0 5">
<Listeners>
<Focus Handler="#{ComboBoxTransferGroupMembers}.store.reload()" />
</Listeners>
<Store>
<ext:Store runat="server" OnReadData="StoreTransferGroupMember_ReadData" ID="StoreXferGroup">
<Model>
<ext:Model IDProperty="Id" runat="server">
<Fields>
<ext:ModelField Name="Name" />
<ext:ModelField Name="Id" />
</Fields>
</ext:Model>
</Model>
<Parameters>
<ext:StoreParameter Mode="Raw" Name="Group" Value="#{ComboBoxTransferGroup}.getValue()" />
</Parameters>
</ext:Store>
</Store>
<DirectEvents>
<Select OnEvent="ComboBoxTransferGroupMembers_Select">
<ExtraParams>
<ext:Parameter Mode="Raw" Name="Group" Value="#{ComboBoxTransferGroup}.getValue()" />
</ExtraParams>
</Select>
</DirectEvents>
</ext:ComboBox>
I am trying to add validation to fields in user profile form.So I added
<field
name="postal_code"
type="text"
id="postal_code"
**class="validate-numeric"**
description="PLG_USER_PROFILE_FIELD_POSTAL_CODE_DESC"
filter="string"
label="PLG_USER_PROFILE_FIELD_POSTAL_CODE_LABEL"
size="30"
/>
to plugins\user\profile\profiles\profile.xml.Its working fine with user registration.How can this be resolved?
Create a class JFormRulePostal_code extending JFormRule in libraries/joomla/form/rule/ and change type="postal_code" and class="postal_code.
I am using angular with angucomplete plugin. https://github.com/darylrowland/angucomplete
How do I prefill the value of the autcomplete textfield? I can't find the answer on the documentation. Is anyone have encounter the same problem and able to solve it?
example:
I am creating the form to add/edit product. product depends on the part. so the part is using angucomplete.
when "editing product" the angucomplete need to prefilled with the part from variable or data binding.
my code :
<div style="display:inline-block;" ng-repeat="part in Productparts">
<!--<input type="text" />-->
<div angucomplete id="autocompletefield{{part.counter}}" placeholder="part" pause="100" selectedObject="partSelectedObject" url="http//www.blablabla.com/part?keyword=" datafield="part" titlefield="name" minlength="2" inputclass="form-control form-control-small"></div>
</div>
now when I am editing the product, the angucomplete needs to prefilled with object part.name
The solution is that I have to update the plugin so it accept prefilled value.
in angucompletejs file in scope I add :
"initialValue": "#initialvalue"
and in link I add :
if($scope.initialValue){
$scope.searchStr = $scope.initialValue;
}
now I can use the initialValue attribute.
<div style="display:inline-block;" ng-repeat="part in Productparts">
<div angucomplete id="autocompletefield{{part.counter}}" placeholder="part" pause="100" selectedObject="partSelectedObject" url="http//www.blablabla.com/part?keyword=" datafield="part" titlefield="name" minlength="2" inputclass="form-control form-control-small" initialValue="{{part.name}}"></div>
</div>
HI guys I have two fields code and name I want to insert into the database the user inputs when they fill the form (I use a wizard)
.py
class cria_edita_recinto(osv.osv):
_name='cria.edita.recinto'
_description = 'Cria e Edita Recinto'
_rec_name='code'
_columns={
'code':fields.char("Código",size=10),
'name':fields.char("Designação",size=50)
}
_sql_constraints = [
('code', 'unique(code)', 'O codigo do recinto deve ser unico')
]
_order = 'code'
def insert_recinto(self,cr, uid,vals, context=None):
lista=vals.values()
code=lista[0]
cr.execute("INSERT INTO gs_recintos (code,name) VALUES (%s,'jt')" %(code))
return True
cria_edita_recinto()
.xml
<record model="ir.ui.view" id="cria_edita_recinto_form">
<field name="name">cria.edita.recinto.form</field>
<field name="model">cria.edita.recinto</field>
<field name="arch" type="xml">
<form string="cria edita recinto" version="7.0">
<group string=" ">
<field name="code"/>
<field name="name"/>
</group>
<footer>
<button name="insert_recinto" string="Configurar Pisos" type="object" class="oe_highlight"/>
ou
<button string="Cancelar" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
I have an image if you could help see here
http://help.openerp.com/question/46472/insert-into-database-the-input-fields/
In openerp 7 osv.osv is deprecated you may use orm.Model
Here the guide lines to write a good code for openerp.
the class that you have post is a module class, but if you would write a record with a wizard
you need to insert insert_recinto method inside a wizard class and not inside a model class.
after in your wizard insert_recinto method you may to write a data in with the orm method like as your_class_object.write(cr,uid,id,vals,context).
I resolved this problem....
<group string=" ">
<field name="code"/>
<field name="name"/>
<field name="nameBilhetes"/>
<field name="recinto_id" on_change="insert_piso(code,name,nameBilhetes,recinto_id)"/>
</group>
I use the on change method and on the .py i use
I query to insert into the Database.
Please mark this answer with the tick this solution resolve my problem