Ver Mensaje Individual
  #5 (permalink)  
Antiguo 29/12/2015, 17:43
aquilesnake
 
Fecha de Ingreso: julio-2010
Mensajes: 19
Antigüedad: 13 años, 9 meses
Puntos: 0
Respuesta: Multiseleccion con Variables distintas

te dejare un ejemplo mejor de como esta y como podria hacerlo.

Mira cuando agrego un box esta variable cambia de nombre al agregar el siguiente dato y esto lo hace por una funcion de JS.

Te muestro el ejemplo que se crea cuando generas otra funcion agregar y porque la agrega asi.

Si me ayudas a entender como atrapar esos dato o modificar como se agrega el parametro nuevo te prendo velas

Este es el codigo que genera un nuevo campo y como son los parametros de ese campo.

Código HTML:
Ver original
  1. <p class="subtitle-manager">Choose your options.</p>
  2.                
  3.             </div>
  4.             <div class="row">
  5.                 <div class="select-mana-event" id="formdup1" name="formdup1">
  6.                    
  7.                         <input class="event-add-style-orchard" type="text" name="select-orch" id="select-orch" value="Orchard" onBlur="if(this.value=='')this.value='Orchard'" onFocus="if(this.value=='Orchard')this.value='' "> <!-- JS because of IE support; better: placeholder="Block" -->
  8.                    
  9.                    
  10.                         <input class="event-add-style-block" type="text" name="select-block" id="select-block" value="Block" onBlur="if(this.value=='')this.value='Block'" onFocus="if(this.value=='Block')this.value='' "> <!-- JS because of IE support; better: placeholder="Block" -->
  11.                    
  12.                     <div class="drop-event2" name="drop-event2" id="drop-event2">
  13.                         <select data-toggle="select" name="select-job" id="select-job">
  14.                             <option value="0"  selected>Job</option>
  15.                             <?php
  16.                                include ("php/rowjob.php");
  17.                            ?>
  18.                         </select>
  19.                     </div>
  20.                    
  21.                         <div class="mana-event-budget" name="mana-event-budget" id="mana-event-budget">$</div>
  22.                         <input class="event-add-style" type="text" name="budget" id="budget" value="Budget" onBlur="if(this.value=='')this.value='Budget'" onFocus="if(this.value=='Budget')this.value='' "> <!-- JS because of IE support; better: placeholder="Who are you looking for?" -->
  23.                    
  24.  
  25.                 </div>
  26.             </div>
  27.             <input type="button" id="btnAdd" class="btn-addform" value="Add more jobs" />
  28.             <input type="button" id="btnDel" class="btn-delform" value="Delete job" />
  29.             <hr class="manager">
  30.             <div classe="step-manager">
  31.                     <p class="number-step">3.</p>
  32.                     <p class="subtitle-manager">Press and send!</p>
  33.             </div>
  34.             <button type="submit" name="validate" class="btn-checkout">Validate</button>
  35.             </form>
  36.         </div>
  37.  
  38.     </body>
  39.     <footer>
  40.        
  41.         <!-- SCRIPT ADD/REMOVE FORM -->
  42.        
  43.         <script>
  44.                 $(function () {
  45.             $('#btnAdd').click(function () {
  46.                 var num     = $('.select-mana-event').length, // how many "duplicatable" input fields we currently have
  47.                     newNum  = new Number(num + 1),      // the numeric ID of the new input field being added
  48.                     newElem = $('#formdup' + num).clone().attr('id', 'formdup' + newNum).fadeIn('slow'); // create the new element via clone(), and manipulate it's ID using newNum value
  49.             // manipulate the name/id values of the input inside the new element
  50.  
  51.                 // orchard
  52.                
  53.                 newElem.find('.event-add-style-orchard').attr('id', 'ID' + newNum + 'select-orch').attr('name', 'ID' + newNum + 'select-orch').val('Orchard');
  54.  
  55.                 // block
  56.                
  57.                 newElem.find('.event-add-style-block').attr('id', 'ID' + newNum + 'select-block').attr('name', 'ID' + newNum + 'select-block').val('Block');
  58.  
  59.                 // job
  60.                
  61.                 newElem.find('.drop-event2').attr('id', 'ID' + newNum + 'drop-event2').attr('name', 'ID' + newNum + 'drop-event2').val('');
  62.            
  63.  
  64.                 // budget
  65.                
  66.                 newElem.find('.mana-event-budget').attr('id', 'ID' + newNum + 'mana-event-budget').attr('name', 'ID' + newNum + 'mana-event-budget').val('');
  67.                 newElem.find('.event-add-style').attr('id', 'ID' + newNum + 'budget').attr('name', 'ID' + newNum + 'budget').val('Budget');
  68.                
  69.                
  70.             // insert the new element after the last "duplicatable" input field
  71.                 $('#formdup' + num).after(newElem);
  72.                
  73.  
  74.             // enable the "remove" button
  75.                 $('#btnDel').attr('disabled', false);
  76.  
  77.             // right now you can only add 5 sections. change '5' below to the max number of times the form can be duplicated
  78.                 if (newNum == 5)
  79.                 $('#btnAdd').attr('disabled', true).prop('value', "You've reached the limit");
  80.             });

Entiendo lo del array porque tambien piens que recorrerlo con un forech seria la opcion pero tampoco recuerdo el uso de for bidireccionales :(.. entonces me cuesta un poco mas necesito un refresh XD..

Amigo gracias por tu ayuda !