SHARE
TWEET

Untitled

a guest Jun 19th, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ...
  2. test = str(request.POST.getlist('testing123[]'))
  3. ...
  4.      
  5. <div class="input-group">
  6.   <input type="text" class="form-control" name="testing123[]">
  7.     <a href="javascript:void(0);" class="add_button_rip btn btn-warning" title="Add field">+</a>
  8. </div>
  9.      
  10. <script type="text/javascript">
  11.   $(document).ready(function(){
  12.       var maxField = 100; //Input fields increment limitation
  13.       var addButton = $('.add_button_rip'); //Add button selector
  14.       var wrapper = $('.field_wrapper_rip'); //Input field wrapper
  15.       var fieldHTML = '<div class="spacer-divide"></div><div class="input-group"><input type="text" class="form-control" name="test"><a href="javascript:void(0);" class="remove_button_rip btn btn-warning" title="Add field">-</a></div>'; //New input field html
  16.       var x = 1; //Initial field counter is 1
  17.  
  18.       //Once add button is clicked
  19.       $(addButton).click(function(){
  20.           //Check maximum number of input fields
  21.           if(x < maxField){
  22.               x++; //Increment field counter
  23.               $(wrapper).append(fieldHTML); //Add field html
  24.           }
  25.       });
  26.  
  27.       //Once remove button is clicked
  28.       $(wrapper).on('click', '.remove_button_rip', function(e){
  29.           e.preventDefault();
  30.           $(this).parent('div').remove(); //Remove field html
  31.           x--; //Decrement field counter
  32.       });
  33.   });
  34.   </script>
  35.      
  36. print (test)
  37. for x in range(len(test)):
  38.   print (test[x],end=" ")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top