使用 Zend_Form 创建 Div?
我想在父 div 中隐藏/存储动态生成的 div。我从表单页面中获取了以下代码段。
....
$existing_billing_address = array();
if (count($all_addr) > 0) {
$hidden_existing_addr_div = '';
foreach ($all_addr as $addrvalue) {
$existing_billing_address[$addrvalue['address_id']] = $addrvalue['address1'];
$exname = $addrvalue['address_name'];
$exaddress1 = $addrvalue['address1'];
$exaddress2 = $addrvalue['address2'];
$excountry = $addrvalue['country'];
$exstate = $addrvalue['state'];
$excity = $addrvalue['city'];
$exzipcode = $addrvalue['zipcode'];
$exphone = $addrvalue['phone'];
$exaddress_id = $addrvalue['address_id'];
$hidden_existing_addr_div .= "<div id='selectBilling_" . $exaddress_id . "' style='display:none'>";
$hidden_existing_addr_div .= $exname . "||" . $exaddress1 . "||" . $exaddress2 . "||" . $excountry . "||" . $exstate . "||" . $excity . "||" . $exzipcode . "||" . $exphone . "||" . $exaddress_id;
$hidden_existing_addr_div .= "</div>";
}
}
....
这将生成如下所示的内容,
> <div style="display: none;" id="selectBilling_40">Dinesh
> billing||billing add1||Billing
> add2||IN||TA||Chennai||625001||1234567891||40</div><div
> style="display: none;" id="selectBilling_41">kumar shipping||shipping
> add1||shipping add2||US||CA||chennai||72944||1234567891||41</div>
我想使用 zend_form 存储上面的隐藏 div。
请帮助我解决这个问题。
I want to hidden/store dynamically generated div inside parent div.I have taken the following piece of code from my form page.
....
$existing_billing_address = array();
if (count($all_addr) > 0) {
$hidden_existing_addr_div = '';
foreach ($all_addr as $addrvalue) {
$existing_billing_address[$addrvalue['address_id']] = $addrvalue['address1'];
$exname = $addrvalue['address_name'];
$exaddress1 = $addrvalue['address1'];
$exaddress2 = $addrvalue['address2'];
$excountry = $addrvalue['country'];
$exstate = $addrvalue['state'];
$excity = $addrvalue['city'];
$exzipcode = $addrvalue['zipcode'];
$exphone = $addrvalue['phone'];
$exaddress_id = $addrvalue['address_id'];
$hidden_existing_addr_div .= "<div id='selectBilling_" . $exaddress_id . "' style='display:none'>";
$hidden_existing_addr_div .= $exname . "||" . $exaddress1 . "||" . $exaddress2 . "||" . $excountry . "||" . $exstate . "||" . $excity . "||" . $exzipcode . "||" . $exphone . "||" . $exaddress_id;
$hidden_existing_addr_div .= "</div>";
}
}
....
This will generate some thing like below,
> <div style="display: none;" id="selectBilling_40">Dinesh
> billing||billing add1||Billing
> add2||IN||TA||Chennai||625001||1234567891||40</div><div
> style="display: none;" id="selectBilling_41">kumar shipping||shipping
> add1||shipping add2||US||CA||chennai||72944||1234567891||41</div>
I want to store the above hidden div using zend_form.
Kindly help me on this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,在这种情况下,您可以使用
Zend_Form
,隐藏它,然后存储它的值,以便您也可以进行验证。如果您想将其显示为 div,可以使用
Zend_Decorator
更改其外观。不管怎样,你不需要隐藏每个元素,你可以隐藏整个表单。Well, in this case you can use a
Zend_Form
, hidden it and then store its values so you can make validation too.If you want to display it as a div, you can change how it looks using
Zend_Decorator
. Anyway, you don't need to hide every element, you can just hide the whole form.我使用了隐藏文本框,使用 jquery 我获取了隐藏文本框值并使用该内容创建 DIV 并清除输入框值。
但我在这里并没有完全使用zend。
I have used hidden text box, Using jquery i ve taken the hidden text box value and create DIV with that content and clear the input box value.
But i am not use zend completely here.