Click here to Skip to main content
15,921,463 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've been trying to bind a value in Ember so that when I submit my form the value selected on the following Radio Button List goes on the POST request, but I've been having some trouble can you guys help?

View radio.js:

SQL
Ember.Radio = Ember.View.extend({
    tagName: "input",
    type: "radio",
    attributeBindings: ["name", "type", "value", "checked:checked:"],
    click: function () {
        this.set("selection", this.$().val())

        if(this.get("selection") === "acRequired") {
            $('#panelAccommodation').css("display", "block");
            this.set("selection", "Required");
            selectionBinding: "App.event.accommodation"
        }
        if (this.get("selection") === "acNotRequired") {
            $('#panelAccommodation').css("display", "none");
            this.set("selection", "Not Required");
            selectionBinding: "App.event.accommodation"
        }
        if (this.get("selection") === "flRequired") {
            $('#panelFlight').css("display", "block");
            this.set("selection", "Required");
            selectionBinding: "App.event.flight"
        }
        if (this.get("selection") === "flNotRequired") {
            $('#panelFlight').css("display", "none");
            this.set("selection", "Not Required");
            selectionBinding: "App.event.flight"
        }
    },

    checked: function () {
        return this.get("value") == this.get("selection");
    }.property()
});


Index.html:

XML
<div class="form-group">
                                    <label for="accommodation">3.2. ACCOMMODATION (*)</label> <br />
                                    <div>
                                        {{view Ember.Radio name="accommodation" selectionBinding='accommodation' value="acNotRequired"}}
                                        Not Required
                                    </div>
                                    <div>
                                        {{view Ember.Radio name="accommodation" selectionBinding='accommodation' value="acRequired"}}
                                        Required
                                    </div>
                                </div>


controller new.js:

C#
App.EventsNewController = Ember.ObjectController.extend({

    accommodation: "Not Required",
    flight: "Not Required",
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900