我正在尝试获取文本框值并尝试分配下一个即将到来的文本字段。
就像在图像中一样,当我尝试向我的第二个文本字段(例如 260 )添加一些值时,它将用前一个字段值填充下一个(例如 kashif 第一个文本字段)字段。这将在第二个字段输入之后起作用,等等.第一次没什么。名称和 ID 是动态生成的,首先它将是 size_min[1_1_0](对于 240)和 size_max[1_1_0](对于 260)。由于该字段的动态 ID,我感到困惑。这是我的 html 代码:
<div class="entry-edit">
<div class="entry-edit-head">
<h4 class="icon-head"><?php echo Mage::helper('mymodule')->__($value['label']." (".$std['name'].")") ?></h4>
</div>
<div>
<div id="addanswer_form" class="fieldset">
<?php
$results = $read->fetchAll("select * from mytable where standards_id =".$std['standards_id']);
foreach($results as $mykey=>$myvar)
{
?>
<div class="hor-scroll" style=" margin-bottom: 2px; ">
<div style=" width:70px; float:left;">
<label for="name" ><?php echo ucwords($myvar['value']);?> </label>
</div>
<div style=" float:left;">
<input type="text" class="required-entry input-text required-entry" style=" float:left; width:60px;" value="" name="size_min[<?php echo $value['dimension_id']."_".$std['standards_id']."_".$myvar['value_id']?>]" id="size_min[<?php echo $value['dimension_id']."_".$std['standards_id']."_".$myvar['value_id']?>]">
</div> <span style="float:left;"> - </span>
<div style=" float:left;">
<input type="text" class="required-entry input-text required-entry" style=" float:left; width:60px;" value="" name="size_max[<?php echo $value['dimension_id']."_".$std['standards_id']."_".$myvar['value_id']?>]" id="size_max[<?php echo $value['dimension_id']."_".$std['standards_id']."_".$myvar['value_id']?>]" >
</div>
</div>
<?php } // end of foreach loop for standard values
?>
</div>
这是 html 格式的输出:
<div class="fieldset" id="addanswer_form">
<div style=" margin-bottom: 2px; " class="hor-scroll">
<div style=" width:70px; float:left;">
<label for="name">Neemh</label>
</div>
<div style=" float:left;">
<input type="text" id="size_min[1_1_7]" name="size_min[1_1_7]" value="" style=" float:left; width:60px;" class="required-entry input-text required-entry">
</div> <span style="float:left;"> - </span>
<div style=" float:left;">
<input type="text" id="size_max[1_1_7]" name="size_max[1_1_7]" value="" style=" float:left; width:60px;" class="required-entry input-text required-entry">
</div>
</div>
<div style=" margin-bottom: 2px; " class="hor-scroll">
<div style=" width:70px; float:left;">
<label for="name">Kashif</label>
</div>
<div style=" float:left;">
<input type="text" id="size_min[1_1_8]" name="size_min[1_1_8]" value="" style=" float:left; width:60px;" class="required-entry input-text required-entry">
</div> <span style="float:left;"> - </span>
<div style=" float:left;">
<input type="text" id="size_max[1_1_8]" name="size_max[1_1_8]" value="" style=" float:left; width:60px;" class="required-entry input-text required-entry">
</div>
</div>
<div style=" margin-bottom: 2px; " class="hor-scroll">
<div style=" width:70px; float:left;">
<label for="name">Shamma</label>
</div>
<div style=" float:left;">
<input type="text" id="size_min[1_1_10]" name="size_min[1_1_10]" value="" style=" float:left; width:60px;" class="required-entry input-text required-entry">
</div> <span style="float:left;"> - </span>
<div style=" float:left;">
<input type="text" id="size_max[1_1_10]" name="size_max[1_1_10]" value="" style=" float:left; width:60px;" class="required-entry input-text required-entry">
</div>
</div>
</div>
</div>