Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactor de añadir modelo

  • Loading branch information...
commit f158b4faf4e4ab22a55ab858790aff8f02950561 1 parent de77d66
@ioachim ioachim authored
View
15 app/application/controllers/modelo.php
@@ -13,17 +13,18 @@ public function __construct()
public function index()
{
- $data = $this->input->post();
-
- //$this->model->add_record($data);
- $this->modelos->insert($data);
- print_r($data);
-
- //$this->load->view("modelo", $data);
+ show();
}
public function add()
{
+ if($this->input->post('add'))
+ {
+ $this->modelos->insert($data);
+ redirect(base_url('modelo'));
+ return;
+ }
+
$data = array();
$data['admin'] = array('hugo', 'paco', 'luis');
View
4 app/application/views/add_modelo.php
@@ -8,10 +8,10 @@
<script type="text/javascript" src="<?php echo base_url('script/dynaform.js') ?>"></script>
- <form action="<?php echo base_url('modelo') ?>" method="post">
+ <form action="<?php echo base_url('modelo/add') ?>" method="post">
<h1>
Agregar Modelo</h1>
- <input type="submit" name="send">
+ <input type="submit" name="add" value="Crear">
<p>
<label>
nombre
View
12 app/script/dynaform.js
@@ -9,9 +9,9 @@ function add_contribfields()
$.map(container.find('input'), function(e, i)
{
e = $(e);
- var input_id = id + '-' + e.attr('name');
+ var input_id = id + '-' + e.attr('nombre');
e.attr('id', input_id);
- e.attr('name', input_id.replace(re_field_id,'[$1]'));
+ e.attr('nombre', input_id.replace(re_field_id,'[$1]'));
}
);
@@ -57,9 +57,9 @@ function get_addmeta_function(meta_list)
$.map(meta.find('input,select'), function(e, i)
{
e = $(e);
- var input_id = meta_id + '-' + e.attr('name');
+ var input_id = meta_id + '-' + e.attr('nombre');
e.attr('id', input_id);
- e.attr('name', input_id.replace(re_field_id,'[$1]'));
+ e.attr('nombre', input_id.replace(re_field_id,'[$1]'));
});
meta_list.append(meta);
@@ -83,9 +83,9 @@ function get_addref_function(ref_list)
$.map(ref.find('input,select'), function(e, i)
{
e = $(e);
- var input_id = ref_id + '-' + e.attr('name');
+ var input_id = ref_id + '-' + e.attr('nombre');
e.attr('id', input_id);
- e.attr('name', input_id.replace(re_field_id,'[$1]'));
+ e.attr('nombre', input_id.replace(re_field_id,'[$1]'));
});
View
6 config/dynaform.htm
@@ -44,7 +44,7 @@
<fieldset class="contrib"><legend>contribución</legend><p>
- <label>nombre<input type="text" name="name" /></label>
+ <label>nombre<input type="text" name="nombre" /></label>
<label>template<input type="text" name="template" /></label></p>
<fieldset class="metadata">
<legend>metadata <a href="#">+</a></legend>
@@ -58,7 +58,7 @@
<div class="metadata">
- <label>nombre<input type="text" name="name" /></label>
+ <label>nombre<input type="text" name="nombre" /></label>
<label>tipo
<select name="tipo">
<option value="text">texto</option>
@@ -71,7 +71,7 @@
</div>
<fieldset class="ref">
- <label>nombre <input type="text" name="name"></label>
+ <label>nombre <input type="text" name="nombre"></label>
<label>tipo destino <input type="text" name="tipo_dest"></label>
<label>template <input type="text" name="template"></label>
<fieldset class="metadata">
View
12 config/dynaform.js
@@ -9,9 +9,9 @@ function add_contribfields()
$.map(container.find('input'), function(e, i)
{
e = $(e);
- var input_id = id + '-' + e.attr('name');
+ var input_id = id + '-' + e.attr('nombre');
e.attr('id', input_id);
- e.attr('name', input_id.replace(re_field_id,'[$1]'));
+ e.attr('nombre', input_id.replace(re_field_id,'[$1]'));
}
);
@@ -57,9 +57,9 @@ function get_addmeta_function(meta_list)
$.map(meta.find('input,select'), function(e, i)
{
e = $(e);
- var input_id = meta_id + '-' + e.attr('name');
+ var input_id = meta_id + '-' + e.attr('nombre');
e.attr('id', input_id);
- e.attr('name', input_id.replace(re_field_id,'[$1]'));
+ e.attr('nombre', input_id.replace(re_field_id,'[$1]'));
});
meta_list.append(meta);
@@ -83,9 +83,9 @@ function get_addref_function(ref_list)
$.map(ref.find('input,select'), function(e, i)
{
e = $(e);
- var input_id = ref_id + '-' + e.attr('name');
+ var input_id = ref_id + '-' + e.attr('nombre');
e.attr('id', input_id);
- e.attr('name', input_id.replace(re_field_id,'[$1]'));
+ e.attr('nombre', input_id.replace(re_field_id,'[$1]'));
});
Please sign in to comment.
Something went wrong with that request. Please try again.