嵌套表单解决方法

时间:2011-08-16 13:18:08

标签: php javascript jquery html ajax

我很清楚嵌套表单是无效的,我正在使用php构建一个简单的表单,并且需要包含另一个控制ajax图像上传框的表单,以便我可以将文件路径提供给原始表单。

以下示例代码;

<form>
    <fieldset>
        <input>
    </fieldset>
    <fieldset>
        <input>
    </fieldset>
    <form action="js/ajaxupload.php" method="post" name="sleeker" id="sleeker" enctype="multipart/form-data">
        <input type="hidden" name="maxSize" value="9999999999" />
        <input type="hidden" name="maxW" value="400" />
        <input type="hidden" name="fullPath" value="http://192.168.10.10:8080/intranet/dashboard/uploads/" />
        <input type="hidden" name="relPath" value="../uploads/" />
        <input type="hidden" name="colorR" value="255" />
        <input type="hidden" name="colorG" value="255" />
        <input type="hidden" name="colorB" value="255" />
        <input type="hidden" name="maxH" value="200" />
        <input type="hidden" name="filename" value="filename" />
        <input type="file" name="filename" style="float:left; width:40% !important;" onchange="ajaxUpload(this.form,'js/ajaxupload.php?filename=name&amp;maxSize=9999999999&amp;maxW=200&amp;fullPath=http://192.168.10.10:8080/intranet/dashboard/uploads/&amp;relPath=../uploads/&amp;colorR=255&amp;colorG=255&amp;colorB=255&amp;maxH=300','upload_area','File Uploading Please Wait…&lt;br /&gt;&lt;img src=\'images/loader_light_blue.gif\' width=\'128\' height=\'15\' border=\'0\' /&gt;','&lt;img src=\'images/error.gif\' width=\'16\' height=\'16\' border=\'0\' /&gt; Error in Upload, check settings and path info in source code.'); return false;" />
    </form>
    <fieldset>
        <input>
    </fieldset>
    <fieldset>
        <input>
    </fieldset>
<submit>
</form>

在之前的项目中,我刚刚将图像上传放在原始表格下方,并将隐藏的输入反馈回原始表格,遗憾的是,这个项目是不可能的,

任何解决这个问题的想法都将不胜感激!

1 个答案:

答案 0 :(得分:0)

是否有任何系统要将External_form.pl解析为Internal_form.pl。例如:

  1. Form.html

    <html>
    ....
    ....
    <form ... method="post" action="External_form.pl">
    ....
    ....
    </form>
    

    此表单将值发布到External_form.pl

  2. External_form.pl

    验证Posted_Data并将此值再次发送到另一个表单Internal_Form.pl

  3. Internal_Form.pl

    它最终将数据发送到(External.pl或Form.html)并在后端处理验证日期。