我正在使用From on laravel 4.2 + Blade。
当使用post发送表单,并使用dd(Item:all)捕获exit时,只有表单的前五个元素是$ Var。
加载我的页面以进行编辑设置后,Laravel和Blade会显示此代码。我认为这是正确的。
UIImageView *tempImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"]];
[tempImageView setFrame:self.tableView.frame];
self.tableView.backgroundView = tempImageView;
dd的排序(Input :: all());在SettingsController.php上
<form method="POST" action="http://fqdn.com/settings" accept-charset="UTF-8" novalidate="novalidate" class="form-horizontal" id="formSettings"><input name="_token" type="hidden" value="iFlxF11zF8afGfqszJyOBgmIzqVLxPrSEl8N6fFK">
<div class="tab-content">
<!-- Tab Storage -->
<div role="tabpanel" class="tab-pane active" id="storage">
<div class="col-sm-12">
<div> </div>
<!-- Option Remote -->
<div class="form-group" id="groupRemote">
<div class="form-group ">
<label for="storageServer" class="col-sm-3 control-label">Remote storage server</label>
<div class="col-sm-9 ">
<input class="form-control" placeholder="FQDN or Ip" name="storageServer" type="text" id="storageServer">
</div>
</div>
<div class="form-group ">
<label for="storagePort" class="col-sm-3 control-label">Port remote storage server</label>
<div class="col-sm-9">
<input class="form-control" placeholder="Port number" name="storagePort" type="text" id="storagePort">
</div>
</div>
<div class="form-group ">
<label for="storageUser" class="col-sm-3 control-label">User remote storage server</label>
<div class="col-sm-9">
<input class="form-control" placeholder="username" name="storageUser" type="text" id="storageUser">
</div>
</div>
<div class="form-group ">
<label for="storagePath" class="col-sm-3 control-label">Path on remote storage server</label>
<div class="col-sm-9">
<input class="form-control" placeholder="/remote/path" name="storagePath" type="text" id="storagePath">
</div>
</div>
</div>
<!-- Option local -->
<div class="form-group hidden" id="groupLocal">
<div class="form-group ">
<label for="storageLocal" class="col-sm-3 control-label">Path on remote storage server</label>
<div class="col-sm-9">
<input class="form-control" placeholder="/local/path" name="storageLocal" type="text" id="storageLocal">
</div>
</div>
</div>
</div>
</div>
<!-- STOP SEND PAR KEY & VALUE of rest of elements of form
<!-- Tab Frecuency -->
<div role="tabpanel" class="tab-pane" id="frequency">
<div class="col-sm-12">
<div> </div>
<div class="form-group" id="groupFrequency">
<div class="form-group ">
<label for="maxDaily" class="col-sm-3 control-label">Limit copies (daily)</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="maxDaily" placeholder="Number copies">
</div>
</div>
<div class="form-group ">
<label for="maxMonthly" class="col-sm-3 control-label">Limit copies (monthly)</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="maxMonthly" placeholder="Number copies">
</div>
</div>
<div class="form-group ">
<label for="maxSnap" class="col-sm-3 control-label">Limit copies (snap)</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="maxSnap" placeholder="Number copies">
</div>
</div>
<div class="form-group ">
<label for="alertSize" class="col-sm-3 control-label">Max size</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="alertSize" placeholder="85 (Maximum size of space on the server to send alert)">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm-4 col-sm-offset-4 text-center">
<input class="btn btn-primary btn-block" type="submit" value="Save">
</div>
我不明白,我没有在表格上看到我的错误。
答案 0 :(得分:1)
如果只看到5个输入(未选中单选框时),代码工作正常,因为如果未选中复选框和单选框,则它们不会作为后置变量传输。如果你有:
<input type="checkbox" name="a" value="a" checked="checked"></input>
您的名为a的帖子变量将包含内容“a”
<input type="checkbox" name="a" value="b" checked="checked"></input>
您的名为a的帖子变量将包含内容“b”
<input type="checkbox" name="a" value="a"></input>
您的名为a的帖子变量将不会被设置(当然,如果未在表单中选中此复选框)。
编辑:
在最后4个输入中没有name属性,将它们添加为“name”,一切都会正常工作。