Encountering an issue with an AngularJS form containing ng-repeat when attempting to submit

Here is my form structure: two text inputs followed by an ng-repeat with a text input and radio button inside.

<form class="form-horizontal" id="myForm" name="myForm">
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label">Company Name</label>
            <div class="col-sm-10">
                <input type="text" name="cname" ng-model="company.name" class="form-control" required></input>
            </div>
        </div>
        <div class="form-group">
            <label for="category" class="col-sm-2 control-label">HQ</label>
            <div class="col-sm-10">
                <select ng-model="company.hq" ng-options="hq as hq.name for hq in hqs" required>
                <option></option>
                </select>
            </div>
        </div>
        <div class="form-group" ng-repeat="item in getR(4) track by $index">
            <label for="name" class="col-sm-2 control-label">Top pick {{$index+1}}</label>
            <div class="col-sm-10">
                <input type="text" name="quizsize" ng-model="company.product[$index]" class="form-control" required></input>
                <label><input type="radio" name="test" ng-model="company.radioValue" value="{{$index+1}}"/> Choose</label>

            </div>
        </div>
        <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit"  value="submit" class="btn btn-primary"  ng-click="addCompany(company)"></button>
            <button type="btn" value="cancel" class="btn btn-danger" ng-click="cancelBtn()">Cancel</button>
        </div>
    </div>
</form>

The controller's addCompany method:

$scope.addCompany = function(company)
    {
        console.log(company.radioValue);
        $http.post('http://localhost/api/index.php/Test/companies', company)
            .success(function(data)
        {
            $scope.companies.push(data[0]);
        })
        .error(function(err)
        {

        })
    };

Function to handle the ng-repeat inputs:

$scope.getR = function(n)
    {
        return Array(n);
    }

Issue when submitting the form:

If I start by entering the company name/hq everything works fine, but if I first click on a radio button and then submit the form, I encounter an undefined radioValue error.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Disconnect occurred during execution of Node.js "hello world" on a Windows 7 operating system

Issue Resolved: Oh no! jimw gets 10000 points for the solution! I've decided to delve into a hobby project using Node.js. Here's where I started: Downloaded and installed Node version 0.6.14 Copied and pasted the classic "hello world" program ...

What is the process of invoking Link manually in React-router?

I am working on a component that is passed a <Link/> object from react-router as a prop. When the user clicks on a 'next' button within this component, I need to manually trigger the <Link/> object. Currently, I am using refs to acce ...

Update the input type on the fly

Hey there, I've got a bit of an unusual question. I'm looking to create a form with fields that vary for each user, like a text input or a checkbox. I attempted using Angular to achieve this: <div ng-controller="myCtrl" ng-repeat="x in prova" ...

Error found in configParser - Error message: The configuration file cli.js is missing a required config object export

I recently started using Protractor and managed to set it up in Eclipse. I followed the guidelines provided in this https://www.protractortest.org/#/ link. The conf.js file contains the following configuration: exports.config = { seleniumAddress: ' ...

The ClearInterval() function does not take effect instantly

I've implemented a Carousel with an auto-toggle feature using the setInterval() function to switch between tabs every 4 seconds. However, I now need to stop this automatic toggling when a specific tab is clicked. You can find the HTML and jQuery for ...

Transform your HTML audio player into a Vue component

I am in the process of converting an HTML player into a Vue component. Half of the component has been successfully converted, but the time control slider is still missing. Below is the original HTML code for the player: // JavaScript code for the audi ...

The Context API leaves me feeling lost and confused

I am currently utilizing Auth0 for user sign up. My goal is to extract the user id listed under sub:value, and then add it to my database to associate it with a user's post. To achieve this, I am attempting to utilize a Context API to retrieve the use ...

Animating content with Jquery Waypoints for a seamless and elegant user experience

Currently tackling a project that requires some jQuery functions beyond my current skill set. Hoping to find some solutions here! The project in question is a one page scroll site, with existing jquery and waypoints functions implemented. Check out the c ...

Once an item is added, the table vanishes into thin air

I have a DataTables setup to show a list of project names, and I have a button that should add an item to the displayed array. However, when I click the button, the table disappears. Below is the code snippet: view.html <button ng-click="vm.add()"> ...

Showing changes in state in real-time using ReactJS: A quick guide

Hello, I am currently facing an issue while trying to add a comment and display it immediately on the DOM. Whenever I type any word in the form box, it does not appear in the box. Additionally, pressing the enter key does not trigger a POST request. Could ...

Finding the current route's path name in AngularJS: a simplified guide

I need a method to get the path name of the current route that I have defined in $routeProvider, such as /customer/:id. While $location.path() provides the path, like /customer/1, it does not give me the path name, /customer/:id. Although $route.current. ...

Utilizing Next 13 for flexible MDX imports

Recently completed the Next13 + MDX Tutorial, however, I am still unclear on how to dynamically load my mdx files. My mdx files are not hosted on a remote server, so I do not require next-mdx-remote. Nonetheless, I am in need of a method to load different ...

Having trouble sending the request body via next-http-proxy-middleware

Recently, I've been attempting to develop a frontend using nextjs that communicates with a Java backend. To achieve this, I'm utilizing the npm package next-http-proxy-middleware. However, it seems like either my request body is getting lost in t ...

Steps for inserting a script tag in an Angular component

My Angular/Typescript website needs to integrate a third-party script that generates a table. However, I'm facing issues with rendering the table within the home.component.html file. I've managed to embed the script, but it doesn't seem to ...

Implementing a delete functionality within a loop on a JavaScript object array

I have a JavaScript object with the following structure: var partner = { p_name: { value: partner_name, label: "Name" }, p_id: { value: partner_ID, label: "ID" }, p_status: { value: partner_status, label: "Status" }, p_email: { value: partner_emai ...

Using httpRequest to handle binary data in JavaScript

Having trouble deciphering the response of an http request that is a binary datastream representing a jpeg image, despite numerous attempts. Edit: Including the full code snippet below: xmlhttp = false; /*@cc_on@*/ /*@if (@_jscript_versio ...

Include an HTML attribute within a given string

Using jQuery, I am adding HTML content to a div. The variables rowString and inputString have been defined beforehand: $("#filterContainer").append( rowString + `<label class='filterLabel' for=${filter}>${filter}< ...

What causes the variable to be undefined in the method but not in the constructor in Typescript?

I am currently working on an application using AngularJS 1.4.9 with Typescript. In one of my controllers, I have injected the testManagementService service. The issue I'm facing is that while the testManagementService variable is defined as an object ...

Tips on validating ASP.NET gridview textbox with javascript during the update process:

I've implemented a gridview on my aspx page: <asp:GridView ID="gvPhoneBook" runat="server" AutoGenerateColumns="false" ShowFooter="true" DataKeyNames="PhoneBookID" ShowHeaderWhenEmpty="true" OnRowCommand="gvPh ...

Is there a method to redirect and display a JavaScript message efficiently?

Once the user has updated a record, I want to automatically redirect them to another page where they will be notified with a JavaScript message (alertify.notify()) confirming that the update was successful. I am unsure if it's possible to dynamically ...