function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ledap13ledap13 

Lightning - Expense tracker -

Hi,
i have a Problem. My Button dont fired.
When I turn on the console.log(amt) after amtField.get("Value") nothing happens. Why?
The calendar will not open. Why?

thanks
 
Moshe Karmel 9Moshe Karmel 9
You need : amtField.get("v.value");
ledap13ledap13
Hi,
sorry, still does not fired my button.
The Code is:
form.cmp
<ui:button aura:id="buttons" label="Submit" press="{!c.createExpense}"/>

formController.js

    createExpense : function(component, event, helper) {
        var amtField = component.find("amount");
        var amt = amtField.get("v.value");
        if (isNaN(amt)||amt==''){
            amtField.setValid("v.value", false);
            amtField.addErrors("v.value", [{message:"Enter an expense amount."}]);
        }
        else {
            amtField.setValid("v.value", true);
            var newExpense = component.get("v.newExpense");
            helper.createExpense(component, newExpense);
        }
    },

Can you help me?