0

我正在使用 CodeIgniter 和我的框架并使用 Javascript 动态创建一些文本输入字段,这一切都很好,但是当我发布表单时,这些新创建的字段不可用?任何想法为什么?我需要在 codeIgniter 中获取这些变量吗?

见下面的代码

谢谢

<head>

<script src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
<script src="/js/jquery.Jcrop.js"></script>

<script type="text/javascript">




$(function() {
var scntDiv = $('#p_scents');
var i = $('#p_scents p').size() + 1;
$('#addScnt').live('click', function() {
$('<p><label for="p_scnts"><input type="text" size="20" name="p_scnt_' + i +'" value="" placeholder="Input Value" /></label> <a href="#" id="remScnt">Remove</a></p>')
i++;
return false;
});

$('#remScnt').live('click', function() {
if( i > 1  ) {
     $(this).parents('p').remove();
     i--;
}
return false;
});
});

</script>

<script type="text/javascript">

jQuery(function($){

var jcrop_api;

$('#target').Jcrop({
onChange:   showCoords,
onSelect:   showCoords,
onRelease:  clearCoords
},function(){
jcrop_api = this;
 });

$('#x2').val(c.x2);
               $('#y2').val(c.y2);
    $('#w').val(c.w);
$('#h').val(c.h);
              };

             function clearCoords()
              {
$('#coords input').val('');
              };


            </script>


</head>
<body>






<?php echo form_open('action'); ?>
                    <table border=1 cellpadding="1" cellspacing="0"  width=80%>
                                            <tr><td colspan=2 align=center>
                                            <a href="#" id="addScnt">Add Another Input Box</a>
                                            </td>
                                            </tr>
                                            <tr><td valign=top>Alternate Urls
                                            </td>
                                            <td>
                                                    <div id="p_scents">
                                                    </div>
                                            <input type=submit>

                                            </td>
                                            </tr>


                    </table>
<?php echo form_close(); ?>
<?php echo validation_errors(); ?>

</body>
4

0 回答 0