gpt4 book ai didi

php - 如何隐藏动态生成的输入标签和归档

转载 作者:行者123 更新时间:2023-11-28 11:04:43 25 4
gpt4 key购买 nike

我正在使用 php mvc。它有一个名为 view create 的文件,它从 mysql 数据库中获取指定的表并为其生成一个表单。

如何隐藏特定字段和标签。

该字段在数据库中被称为 allowed,当生成 html 时,它的 id 是 input_allowed。

提前致谢。

编辑:该字段已使用 #input_allowed{display:none;} 隐藏,但标签(名为 allowed 的文本,实际上不是标签,但显示在 a 内)仍在显示。

这是 view_create.php 文件的代码。

<?

$class_obj=$_REQUEST['class_obj'];

echo "<p class='p1'>Create new ".$class_obj."</p>";
if (isset($_REQUEST['post_create']))
{
post_create_message($_REQUEST['post_create'],$class_obj);
}


echo "<table class=table1><form id=form_create action=".$current_file_name."?here=".$here."&mode=confirm_create&class_obj=".$class_obj." method=post>";

$w_columns = MyActiveRecord::Columns($class_obj);
foreach($w_columns as $wcolumns_key => $wcolumns_value)
{
if ($wcolumns_key != "id")
{
//if($wcolumns_key == "date")
if(MyActiveRecord::GetType($class_obj,$wcolumns_key) == 'date')
{
echo "<tr><td>".$wcolumns_key."<td><input type=text id='input_".$wcolumns_key."' name='input_".$wcolumns_key."' value=''>";
echo "<td><input type=button value='Set Date' onclick=displayDatePicker('input_".$wcolumns_key."',false,'ymd','-'); >";

//echo "<tr id='arow'><td>".$wcolumns_key."<td><input type=text id='input_".$wcolumns_key."' name='input_".$wcolumns_key."' value='' datepicker='true' datepicker_format='DD/MM/YYYY'>";
//echo "<tr><td>".$wcolumns_key."<td><input type=text id='input_".$wcolumns_key."' name='input_".$wcolumns_key."' value='' datepicker='true' datepicker_format='DD/MM/YYYY'><td><div id='aaa'>&nbsp;</div><script>var b = new free_date_picker('b', 'aaa', 'input_".$wcolumns_key."', 1, true, 'en');</script>";




}
else
{

echo "<tr><td>".$wcolumns_key."<td><input type=text id='input_".$wcolumns_key."' name='input_".$wcolumns_key."' value=''>";
if (strlen($wcolumns_key)> 2 && !(strpos($wcolumns_key,"_id")===false))
{
//$related_class = substr($wcolumns_key, 0, -3);
$related_class = find_relatedclass($wcolumns_key,$foreign_keys);
echo "<td><select id='select_".$wcolumns_key."' onChange=javascript:change_obj('".$wcolumns_key."') ><option></option>";

foreach ($obj_class = MyActiveRecord::FindBySql($related_class, 'SELECT * FROM '.$related_class.' WHERE id > -1 ORDER BY referred_as') as $obj_attribute => $obj_attr_value)
{
// echo "<option>".$obj_attribute." - ".$obj_attr_value->referred_as; // it works, but...

echo "<option value='".$obj_attr_value->id."'>".$obj_attr_value->id." - ".$obj_attr_value->referred_as;

//echo "(".$wcolumns_key.")";

if (strlen($wcolumns_key)> 2 && !(strpos($wcolumns_key,"_id")===false))
{
// $related_superclass = substr($wcolumns_key, 0, -3);
$related_superclass = find_relatedclass($wcolumns_key,$foreign_keys);
foreach ($super_obj = MyActiveRecord::Columns($related_superclass) as $super_obj_attribute => $super_obj_value)
{
if (strlen($super_obj_attribute)> 2 && !(strpos($super_obj_attribute,"_id")===false))
{
//$related_supersuperclass = substr($super_obj_attribute, 0, -3);
$related_supersuperclass = find_relatedclass($super_obj_attribute,$foreign_keys);

//$related_superobj = $obj_attr_value->find_parent($related_supersuperclass)->referred_as;
$related_superobj = $obj_attr_value->find_parent($related_supersuperclass,$super_obj_attribute)->referred_as;
//echo "<td>".$obj_value->$obj_attribute.". ".$obj_value->find_parent($related_class,$obj_attribute)->referred_as;


echo " (".$related_superobj.")";
}
}
}
}
echo "</select >";
}

}
}
}

foreach ($join_tables as $jt_key => $jt_value)
{
$pos = strpos($jt_value,$here);
if($pos === false) {
// string needle NOT found in haystack
}
else { // string needle found in haystack

$there = str_replace("_","",$jt_value);
$there = str_replace($here,"",$there);

include "view_displayjt.php";
}
}


echo "<tr><td><td><input type=button value='Create new ".$here."' onClick=javascript:confirm_create('form_create');><td><input type=reset >";
echo "</table></form>";

?>

最佳答案

将文本包裹在一个跨度内,并为跨度和输入指定一个唯一的类名(例如,“hideme”)。这样,您在使用 CSS 时会获得一点灵 active 。如果出于某种原因您不能使用某个类,则将“display:none”添加到 span 中就可以解决问题。

关于php - 如何隐藏动态生成的输入标签和归档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22307313/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com