<commit_before>﻿@model Pollerino.Models.Poll

@{
    ViewBag.Title = "Home Page";
}


<div class="">
    <div>

        @using (Html.BeginForm())
        {
            <div>
                @Html.AntiForgeryToken()
                <br />
                @Html.TextBoxFor(m => m.QuestionText, new { Value = "Enter your poll question here..." })
                <br />
                @Html.CheckBoxFor(m => m.MultipleChoices)
                <br />

                @*    @{
                    var options = new List<Pollerino.Models.Option>();
                    }
                *@

                @{int numOptions = 3;}

                @for (int i = 0; i < numOptions; i++)
                {
                    //  @Html.TextBoxFor( model=>model.Options[i].OptionText)
                    //   @Html.EditorFor(m => m.Options[i].OptionText);
                    <span>@(i + 1)</span> <input name="Options[@i].OptionText" type="text" />
                    <br />
                }


                @*
                    <span id="option"></span>
                    <script type="text/javascript">
                        var numOptions = parseInt(@numOptions.ToString());

                        $(function () {
                            var NewOption = '<span>' + numOptions + ' </span><input name="Options[' + numOptions + '].OptionText" type="text"/><br/>'
                            $(".add").click(function () {
                                numOptions = +1;
                                $("#option").after(NewOption);
                            });
                        });
                    </script>
                    <span class="add">add</span>
                *@

               @*credits http://www.sanwebe.com/2013/03/addremove-input-fields-dynamically-with-jquery*@

                <script type="text/javascript">
                    $(document).ready(function () {

                        var max_fields = 17; //maximum input boxes allowed
                        var wrapper = $(".input_fields_wrap"); //Fields wrapper
                        var add_button = $(".add_field_button"); //Add button ID

                        var x = 3; //initlal text box count
                        $(add_button).click(function (e) { //on add input button click
                            e.preventDefault();
                            numOptions = +1;
                            if (x < max_fields) { //max input box allowed
                                x++; //text box increment
                                $(wrapper).append('<div> <span>' + x + '. </span><input name="Options[' + 3 + '].OptionText" type="text" name="mytext[]"/><a href="#" class="remove_field">Remove</a></div>'); //add input box
                            }
                        });

                        $(wrapper).on("click", ".remove_field", function (e) { //user click on remove text
                            e.preventDefault(); $(this).parent('div').remove(); x--;
                        })
                    });
                </script>


                <div class="input_fields_wrap">
                    <div><span>1.</span><input type="text" name="mytext[]"></div>
                    <div><span>2.</span><input type="text" name="mytext[]"></div>
                    <div><span>3.</span><input type="text" name="mytext[]"></div>

                </div>
                <button class="add_field_button">Add More Fields</button>


                <br />
                <input type="submit" value="Create" />
            </div>
        }
    </div>

</div><commit_msg>fixed indexes<commit_after>﻿@model Pollerino.Models.Poll

@{
    ViewBag.Title = "Home Page";
}


<div class="">
    <div>

        @using (Html.BeginForm())
        {
            <div>
                @Html.AntiForgeryToken()
                <br />
                @Html.TextBoxFor(m => m.QuestionText, new { Value = "Enter your poll question here..." })
                <br />
                @Html.CheckBoxFor(m => m.MultipleChoices)
                <br />

                @*    @{
                    var options = new List<Pollerino.Models.Option>();
                    }
                *@

                @*
                    @{int numOptions = 3;}

                    @for (int i = 0; i < numOptions; i++)
                    {
                        //  @Html.TextBoxFor( model=>model.Options[i].OptionText)
                        //   @Html.EditorFor(m => m.Options[i].OptionText);
                        <span>@(i + 1)</span> <input name="Options[@i].OptionText" type="text" />
                        <br />
                    }
                *@

                @*
                    <span id="option"></span>
                    <script type="text/javascript">
                        var numOptions = parseInt(@numOptions.ToString());

                        $(function () {
                            var NewOption = '<span>' + numOptions + ' </span><input name="Options[' + numOptions + '].OptionText" type="text"/><br/>'
                            $(".add").click(function () {
                                numOptions = +1;
                                $("#option").after(NewOption);
                            });
                        });
                    </script>
                    <span class="add">add</span>
                *@

                @*credits http://www.sanwebe.com/2013/03/addremove-input-fields-dynamically-with-jquery*@

                <script type="text/javascript">
                    $(document).ready(function () {

                        var max_fields = 17; //maximum input boxes allowed
                        var wrapper = $(".input_fields_wrap"); //Fields wrapper
                        var add_button = $(".add_field_button"); //Add button ID

                        var x = 3; //initlal text box count
                        $(add_button).click(function (e) { //on add input button click
                            e.preventDefault();
                            numOptions = +1;
                            if (x < max_fields) { //max input box allowed
                                x++; //text box increment
                                $(wrapper).append('<div> <span>' + x + '. </span><input name="Options[' + (x-1) + '].OptionText" type="text" name="mytext[]"/><a href="#" class="remove_field">Remove</a></div>'); //add input box
                            }
                        });

                        $(wrapper).on("click", ".remove_field", function (e) { //user click on remove text
                            e.preventDefault(); $(this).parent('div').remove(); x--;
                        })
                    });
                </script>


                <div class="input_fields_wrap">
                    <div><span>1. </span><input name="Options[0].OptionText" type="text" /></div>
                    <div><span>2. </span><input name="Options[1].OptionText" type="text" /></div>
                    <div><span>3. </span><input name="Options[2].OptionText" type="text" /></div>
                </div>
                <button class="add_field_button">Add More Fields</button>


                <br />
                <input type="submit" value="Create" />
            </div>
        }
    </div>

</div>
{'fraction_non_alphanumeric': 0.15085324232081912, 'fraction_numerical': 0.005324232081911262, 'mean_word_length': 1.0991404011461319, 'pattern_counts': {'":': 0, '<': 115, '<?xml version=': 0, '>': 119, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '813436', 'n_tokens_mistral': 1932, 'n_tokens_neox': 1761, 'n_words': 356}