Feedback:   mdelrosso@gmail.com  Seguir a @mdelrosso en Twitter @mdelrosso   Desarrollo:  Proyecto en Github Proyecto en Github  Reportar un error Reportar un error  HashTag en Twitter #sheepit

Formularios pre-generados

Incluir archivos necesarios

            <script type="text/javascript" src="jquery-1.4.min.js"></script>
            <script type="text/javascript" src="jquery.sheepItPlugin-1.1.1.min.js"></script>            

Código javascript

            
$(document).ready(function() {
				
	var sheepItForm = $('#sheepItForm').sheepIt({
		separator: '',
		allowRemoveLast: true,
		allowRemoveCurrent: true,
		allowRemoveAll: true,
		allowAdd: true,
		allowAddN: true,
		maxFormsCount: 10,
		minFormsCount: 0,
		iniFormsCount: 0,
		pregeneratedForms: ['pregenerated_form_1'] // Ids
	});
                
});
			

Plantilla HTML

            
<style>

a {
    text-decoration:underline;
    color:#00F;
    cursor:pointer;
}

#sheepItForm_controls div, #sheepItForm_controls div input {
    float:left;    
    margin-right: 10px;
}


</style>

<!-- sheepIt Form -->
<div id="sheepItForm">
 
    <!-- Form template-->
    <div id="sheepItForm_template">
        <label for="sheepItForm_#index#_phone">Phone <span id="sheepItForm_label"></span></label>
        <input id="sheepItForm_#index#_phone" name="person[phones][#index#][phone]" type="text" size="15" maxlength="10" />
        <a id="sheepItForm_remove_current"><img class="delete" src="images/cross.png" width="16" height="16" border="0"></a>
    </div>
    <!-- /Form template-->
  
    <!-- Pre-generated form -->
    <div id="pregenerated_form_1">
        <label for="sheepItForm_#index#_phone">Phone <span id="sheepItForm_label"></span></label>
        <input id="sheepItForm_#index#_phone" name="person[phones][#index#][phone]" type="text" size="15" maxlength="10" />
        <a id="sheepItForm_remove_current"><img class="delete" src="images/cross.png" width="16" height="16" border="0"></a>
    </div>
    <!-- /Pre-generated form -->
   
    <!-- No forms template -->
    <div id="sheepItForm_noforms_template">No phones</div>
    <!-- /No forms template-->
    
    <!-- Controls -->
    <div id="sheepItForm_controls">
        <div id="sheepItForm_add"><a><span>Add phone</span></a></div>
        <div id="sheepItForm_remove_last"><a><span>Remove</span></a></div>
        <div id="sheepItForm_remove_all"><a><span>Remove all</span></a></div>
        <div id="sheepItForm_add_n">
          <input id="sheepItForm_add_n_input" type="text" size="4" />
          <div id="sheepItForm_add_n_button"><a><span>Add</span></a></div></div>
    </div>
    <!-- /Controls -->
   
</div>
<!-- /sheepIt Form -->
            

Resultado

Nueva persona
Datos principales
No hay teléfonos

Descargar el ejemplo completo

Descargar - example4.rar