отправить добавленные динамические входы - PullRequest
0 голосов
/ 31 марта 2020

Я пытаюсь отправить форму некоторых входных данных и некоторых добавленных входных данных, но возвращаемый запрос показывает только форму, которая не была добавлена ​​

Html

<div class="col-lg-4">
          <div class="row create-main">
            <div class="col-md-12 create">
              <div class="create-heading">
                <h1>1. Program Settings</h1>



              </div>

              <div class="createbutton">
                <div class="createbutton-show program-show">
                  <button type="button">Show</button>
                </div>
                <div class="slash">
                  <i>&nbsp;&sol;&nbsp;</i>
                </div>
                <div class="createbutton-hide program-hide">
                  <button type="button">Hide</button>
                </div>      
              </div>


            </div>
            <div class="container col-md-12" id="program-content">

                  {!! Form::open(['method' => 'POST' , 'action' => 'UsersController@store', 'id'=> 'form1' ]) !!}

                    <div class="form-group font-size-80">
                      {!! Form::label('program_name', 'Program Name:') !!}
                      {!! Form::text('program_name',null , ['class' => 'form-control']) !!}
                    </div>

                    <div class="form-group font-size-80">
                      {!! Form::label('program_description', 'Program Description:') !!}
                      {!! Form::textarea('program_description',null , ['class' => 'form-control', 'rows'=>'3']) !!}
                    </div>

                    <div class="form-group font-size-80">
                      {!! Form::label('business_name', 'Business Name:') !!}
                      {!! Form::text('business_name',null , ['class' => 'form-control']) !!}
                    </div>

                    <div class="form-group font-size-80">
                      {!! Form::label('program_reward_type_id', 'How will you reward people?') !!}
                      {!! Form::select('program_reward_type_id',$programRewardType,null , ['class' => 'form-control']) !!}
                    </div>

                    <div class="form-group font-size-80">
                      {!! Form::label('No_hours', 'Minimum number of hours between check-ins') !!}
                      <div class="row">
                      {!! Form::text('No_hours', null , ['class' => 'form-control col-sm-2 program-hour']) !!}
                      {!! Form::select('program_reward_type_id',$programScreenType,null , ['class' => 'form-control col-sm-9 program-select']) !!}
                    </div>
                    </div>




                  </div>

            <!-- <div class="bottom-line"></div> -->

            <div class="col-md-12 create">
              <div class="create-heading">
                <h1>2. Rewards Offer</h1>
              </div>

              <div class="createbutton">
                <div class="createbutton-show reward-show">
                  <button type="button">Show</button>
                </div>
                <div class="slash">
                  <i>&nbsp;&sol;&nbsp;</i>
                </div>
                <div class="createbutton-hide reward-hide">
                  <button type="button">Hide</button>
                </div>      
              </div>
            </div>

            <div class="container col-md-12" >
                <div id="reward-content">
                  <div id="reward-content-form">
                    <div class="reward-contents">

                    </div>


                        </div>
                        <button type="button" class="reward-offer-btn"><i class="fas fa-plus"></i><span class="reward-offer-text">Reward Offer</span></button>
                      </div>

                    </div>


            <div class="col-md-12 create">
              <div class="create-heading">
                <h1>3. Check-In Screen</h1>
              </div>

              <div class="createbutton">
                <div class="createbutton-show check-in-show">
                  <button type="button">Show</button>
                </div>
                <div class="slash">
                  <i>&nbsp;&sol;&nbsp;</i>
                </div>
                <div class="createbutton-hide check-in-hide">
                  <button type="button">Hide</button>
                </div>      
              </div>
            </div>

            <div class="container col-md-12" >
                <div id="check-in-content">
                  <div id="check-in-content-form">
                    <div class="check-in-contents">

                    </div>

                        </div>
                        <button type="button" class="check-in-btn"><i class="fas fa-plus"></i><span class="check-in-text">Add Check-in Screen</span></button>
                      </div>

                    </div>

            <div class="col-md-12 create">
              <div class="create-heading">
                <h1>4. SMS Updates</h1>
              </div>

              <div class="createbutton">
                <div class="createbutton-show sms-updates-show">
                  <button type="button">Show</button>
                </div>
                <div class="slash">
                  <i>&nbsp;&sol;&nbsp;</i>
                </div>
                <div class="createbutton-hide sms-updates-hide">
                  <button type="button">Hide</button>
                </div>      
              </div>
            </div>

            <div class="container col-md-12" id="sms-update-content">

                  <!--{!! Form::open(['method' => 'POST' , 'action' => 'UsersController@store', 'id' => 'form4', 'name' => 'form']) !!}-->
                    <div class="form-group font-size-80">
                      {!! Form::label('sms_point_check', 'Send a text message when only points are earned:') !!}
                      {!! Form::select('sms_point_check',['' => 'yes'],null , ['class' => 'form-control']) !!}
                    </div>

                    <div class="form-group font-size-80">
                      {!! Form::label('sms_points_earned_message', 'Points earned message:') !!}
                      {!! Form::textarea('sms_points_earned_message',null , ['class' => 'form-control', 'rows'=>'3']) !!}
                    </div>

                    <div class="form-group font-size-80">
                      {!! Form::label('sms_point_reward_check', 'Send a text message when points & rewards are earned:') !!}
                      {!! Form::select('sms_point_reward_check',['' => 'yes'],null , ['class' => 'form-control']) !!}
                    </div>

                    <div class="form-group font-size-80">
                      {!! Form::label('sms_points_rewards_earned_message', 'Points & Rewards earned message:') !!}
                      {!! Form::textarea('sms_points_rewards_earned_message',null , ['class' => 'form-control', 'rows'=>'3']) !!}
                    </div>

                      {!! Form::submit('submit',['class' => 'btn btn-primary', 'id' => 'save']) !!}
                    {!! Form::close() !!} 





                  </div>

            <div class="col-md-12 save-cancel">
              <div class="cancel">
                <button>Cancel</button>
              </div>
              <div class="save">
                <button type="submit" onclick="formSubmit()">Save Program</button>
              </div>
            </div>

          </div>


        </div>

Jquery

$('.reward-offer-btn').click(function(){
  $( ".reward-contents" ).append( '<div class="reward-add" id="'+r_id[count]+'"><i class="fa fa-star star-icon" aria-hidden="true"></i><span class="reward-name">new reward</span><i class="fas fa-trash-alt trash-icon" onclick="deleteReward(this)"></i><i class="fas fa-copy copy-icon" onclick="copyReward(this)" aria-hidden="true"></i><i class="fa fa-cog cog-icon" onclick="openForm(this)" aria-hidden="true"></i><div class="reward-form" id="'+r_id[count]+'" style="display:none;"><!--{!! Form::open(['method' => 'POST' , 'action' => 'UsersController@store', 'id' => 'form2', 'class' => 'form' ]) !!}--><div class="form-group font-size-80">{!! Form::label('reward_name[]', 'Reward Name:') !!}{!! Form::text('reward_name[]',null , ['onchange' => 'rewardNameAssign(this);' , 'class' => 'form-control']  ) !!}</div><div class="form-group font-size-80">{!! Form::label('reward_description[]', 'Reward Description:') !!}{!! Form::textarea('reward_description[]',null , ['class' => 'form-control', 'rows'=>'3']) !!}</div><div class="form-group font-size-80">{!! Form::label('reward_points_cost[]', 'Points Cost:') !!}{!! Form::text('reward_points_cost[]',null , ['class' => 'form-control']) !!}</div><!--{!! Form::close() !!}--></div></div>' );
  count++;
  r_id[count] = count;

});


$('.check-in-btn').click(function(){
  $( ".check-in-contents" ).append( '<div class="check-in-add" id="'+ch_id[count_ch]+'"><i class="fa fa-star star-icon" aria-hidden="true"></i><span class="check-in-name">new check in screen</span><i class="fas fa-trash-alt trash-icon" onclick="deleteCheckIn(this)"></i><i class="fas fa-copy copy-icon" onclick="copyCheckInScreen(this)" aria-hidden="true"></i><i class="fa fa-cog cog-icon" onclick="openCheckInForm(this)" aria-hidden="true"></i><div class="check-in-form" id="'+ch_id[count_ch]+'" style="display:none;"><!--{!! Form::open(['method' => 'POST' , 'action' => 'UsersController@store', 'id' => 'form3', 'class' => 'form' ]) !!}--><div class="form-group font-size-80">{!! Form::label('screen_name[]', 'Screen Name:') !!}{!! Form::text('screen_name[]',null , [ 'class' => 'form-control', 'onchange' => 'checkInNameAssign(this)'] ) !!}</div><div class="form-group font-size-80">{!! Form::label('subscription_name[]', 'Subscribe new people to a textword?:') !!}{!!Form::select('subscription_name[]',['' => 'no'],null , ['class' => 'form-control']) !!}</div><div class="form-group font-size-80">{!! Form::label('main_heading[]', 'Main Heading:') !!}{!! Form::text('main_heading[]',null , [ 'class' => 'form-control', 'onchange' => 'screenText(this)'] ) !!}</div><div class="form-group font-size-80">{!! Form::label('main_sub_heading[]', 'Main Sub-Heading:') !!}{!! Form::text('main_sub_heading[]',null , [ 'class' => 'form-control', 'onchange' => 'screenText(this)'] ) !!}</div><div class="form-group font-size-80">{!! Form::label('fine_print[]', 'Fine Print:') !!}{!! Form::textarea('fine_print[]',null , ['class' => 'form-control', 'rows'=>'3', 'onchange' => 'screenText(this)']) !!}</div><div class="form-group font-size-80">{!! Form::label('logo_url[]', 'Logo URL:') !!}<div class="row">{!! Form::text('logo_url[]',null , ['class' => 'form-control col-sm-9 logo-url']) !!}{!! Form::button('Find', ['class' => 'form-control btn btn-primary col-sm-2 find-logo-url', 'onclick' => 'changeScreenLogo()']) !!}</div></div><div class="form-group font-size-80 slider-span">{!! Form::label('logo_size[]', 'Logo Size:') !!}{!! Form::range('logo_size[]',null , [ 'class' => 'form-control slider' , 'min' => '50' , 'max' => '120' , 'value' => '100', 'onchange' => 'changeLogoSize(this)'] ) !!}</div><div class="form-group font-size-80 slider-span">{!! Form::label('background_color[]', 'Background Color:') !!}{!! Form::text('background_color[]',null , [ 'class' => 'form-control col-sm-6' , 'id' => 'colorpickerBackgroundField' , 'onclick' => 'changeColor(this)'] ) !!}</div><div class="form-group font-size-80 slider-span">{!! Form::label('text_color[]', 'Text Color:') !!}{!! Form::text('text_color[]',null , [ 'class' => 'form-control col-sm-6' , 'id' => 'colorpickerTxtField' , 'onclick' => 'changeColor(this)'] ) !!}</div><div class="form-group font-size-80 slider-span">{!! Form::label('primary_color[]', 'Primary Color:') !!}{!! Form::text('primary_color[]',null , [ 'class' => 'form-control col-sm-6' , 'id' => 'colorpickerPrimaryField' , 'onclick' => 'changeColor(this)'] ) !!}</div><div class="form-group font-size-80 slider-span">{!! Form::label('button_color[]', 'Button Color:') !!}{!! Form::text('button_color[]',null , [ 'class' => 'form-control col-sm-6' , 'id' => 'colorpickerBtnField' , 'onclick' => 'changeColor(this)'] ) !!}</div><div class="form-group font-size-80 slider-span">{!! Form::label('button_text_color[]', 'Button Text Color:') !!}{!! Form::text('button_text_color[]',null , [ 'class' => 'form-control col-sm-6' , 'id' => 'colorpickerBtnTxtField' , 'onclick' => 'changeColor(this)'] ) !!}</div><div class="form-group font-size-80 slider-span">{!! Form::label('icon_color[]', 'Icon Color:') !!}{!! Form::text('icon_color[]',null , [ 'class' => 'form-control col-sm-6' , 'id' => 'colorpickerIconField' , 'onclick' => 'changeColor(this)'] ) !!}</div><!--{!! Form::close() !!}--></div></div>' );
  count_ch++;
  ch_id[count_ch] = count_ch;

});

Существует два входа для вознаграждения в виде дополнений и входов на экране регистрации. Я могу отправлять только запросы входов из формы html, а не добавленные. Я попытался сделать их все отдельные формы, а затем отправить их по щелчку, но могу получить только первую форму.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...