- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 PHP 脚本,我试图用它从 html 文档中提取表单数据,对其进行处理,然后将数据写入 mysql 数据库表。
我可以让脚本写入 mysql 数据库,但它只传递空字符串,我在脚本开头将变量声明为空字符串,然后从表单元素传递 $_POST 数据,但是它似乎不起作用,我已经尝试了各种引用和连接方式,但没有成功。
当我回显变量时,它们在那里,但只是空的,这是代码,它的形式相当长,但大多数变量都以相同的方式处理,任何帮助将不胜感激,我对 PHP 还很陌生。
<?PHP
//Create null variables
$datereportId = "";
$timereportId = "";
$nameinvolvedId = "";
$maleinvolvedId = "";
$femaleinvolvedId = "";
$addressinvolvedId = "";
$telinvolvedId = "";
$deptinvolvedId = "";
$jobinvolvedId = "";
$supinvolvedId = "";
$cjemployId = "";
$othemployId = "";
$contractId = "";
$visitId = "";
$paxId = "";
$publicId = "";
$apronId = "";
$terminalId = "";
$hangarId = "";
$terminalId = "";
$othlocationId = "";
$captainId = "";
$csId = "";
$aircraftId = "";
$fltnoId = "";
$seatnoId = "";
$sectorId = "";
$accbyId = "";
$relationId = "";
$dateaccId = "";
$timeaccId = "";
$weathercondId = "";
$weathercommentsId = "";
$normdutyId = "";
$normdutnId = "";
$areacleanyId = "";
$areacleannId = "";
$heatyId = "";
$heatnId = "";
$ppeyId = "";
$ppenId = "";
$equipyId = "";
$equipnId = "";
$commentsId = "";
$accna1Id = "";
$accfi2Id = "";
$accex3Id = "";
$accel4Id = "";
$accco5Id = "";
$accob6Id = "";
$accfa7Id = "";
$accsl8Id = "";
$accma9Id = "";
$accpl10Id = "";
$accst11Id = "";
$accve12Id = "";
$accph13Id = "";
$accsh14Id = "";
$accth15Id = "";
$accot16Id = "";
$acccomments17Id = "";
$injna1Id = "";
$injab2Id = "";
$injla3Id = "";
$injbu4Id = "";
$injbr5Id = "";
$injfa6Id = "";
$injir7Id = "";
$injbl8Id = "";
$injfr9Id = "";
$injin10Id = "";
$injre11Id = "";
$injcr12Id = "";
$injel13Id = "";
$injco14Id = "";
$injsh15Id = "";
$injot16Id = "";
$injcomments17Id = "";
$bodna1Id = "";
$bodab2Id = "";
$bodba3Id = "";
$bodch4Id = "";
$bodhe5Id = "";
$bodey6Id = "";
$bodea7Id = "";
$bodno8Id = "";
$bodte9Id = "";
$bodha10Id = "";
$bodar11Id = "";
$bodle12Id = "";
$bodkn13Id = "";
$bodan14Id = "";
$bodfo15Id = "";
$bodot16Id = "";
$bodcomments17Id = "";
$faidyId = "";
$faidnId = "";
$faidy_nameId = "";
$fkityId = "";
$fkitnId = "";
$fkity_nameId = "";
$doctyId = "";
$doctnId = "";
$docty_commentId = "";
$hospyId = "";
$hospnId = "";
$hospy_commentId = "";
$medic_commentId = "";
$wit1nameId = "";
$wit1addrId = "";
$wit1telId = "";
$wit2nameId = "";
$wit2addrId = "";
$wit2telId = "";
$wit3nameId = "";
$wit3addrId = "";
$wit3telId = "";
$submitbyId = "";
$submitbyemailId = "";
$submitbytitleId = "";
$submitbydeptId = "";
$sexinvolvedId = "";
$orginvolved = "";
$location = "";
$normalduty = "";
$areaclean = "";
$heating = "";
$ppeworn = "";
$equipcheck = "";
$accnature = "";
$injnature = "";
$bodnature = "";
$firstaid = "";
$fakused = "";
$doctor = "";
$hospreq = "";
//If form is submitted populate data
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
//Populate variables with sanitised data variables
//$datereportId = test_input($_POST["id_datereport"]);
//$timereportId = test_input($_POST["id_timereport"]);
$nameinvolvedId = test_input($_POST["id_nameinvolved"]);
$maleinvolvedId = test_input($_POST["id_maleinvolved"]);
$femaleinvolvedId = test_input($_POST["id_femaleinvolved"]);
$addressinvolvedId = test_input($_POST["id_addressinvolved"]);
$telinvolvedId = test_input($_POST["id_telinvolved"]);
$deptinvolvedId = test_input($_POST["id_deptinvolved"]);
$jobinvolvedId = test_input($_POST["id_jobinvolved"]);
$supinvolvedId = test_input($_POST["id_supinvolved"]);
$cjemployId = test_input($_POST["id_cjemploy"]);
$othemployId = test_input($_POST["id_othemploy"]);
$contractId = test_input($_POST["id_contract"]);
$visitId = test_input($_POST["id_visit"]);
$paxId = test_input($_POST["id_pax"]);
$publicId = test_input($_POST["id_public"]);
$apronId = test_input($_POST["id_apron"]);
$terminalId = test_input($_POST["id_terminal"]);
$hangarId = test_input($_POST["id_hangar"]);
$terminalId = test_input($_POST["id_terminal"]);
$othlocationId = test_input($_POST["id_othlocation"]);
$captainId = test_input($_POST["id_captain"]);
$csId = test_input($_POST["id_cs"]);
$aircraftId = test_input($_POST["id_aircraft"]);
$fltnoId = test_input($_POST["id_fltno"]);
$seatnoId = test_input($_POST["id_seatno"]);
$sectorId = test_input($_POST["id_sector"]);
$accbyId = test_input($_POST["id_accby"]);
$relationId = test_input($_POST["id_relation"]);
//$dateaccId = test_input($_POST["id_dateacc"]);
//$timeaccId = test_input($_POST["id_timeacc"]);
$weathercondId = test_input($_POST["id_weathercond"]);
$weathercommentsId = test_input($_POST["id_weathercomments"]);
$normdutyId = test_input($_POST["id_normduty"]);
$normdutnId = test_input($_POST["id_normdutn"]);
$areacleanyId = test_input($_POST["id_areacleany"]);
$areacleannId = test_input($_POST["id_areacleann"]);
$heatyId = test_input($_POST["id_heaty"]);
$heatnId = test_input($_POST["id_heatn"]);
$ppeyId = test_input($_POST["id_ppey"]);
$ppenId = test_input($_POST["id_ppen"]);
$equipyId = test_input($_POST["id_equipy"]);
$equipnId = test_input($_POST["id_equipn"]);
$equipcommentsId = test_input($_POST["id_equipcomments"]);
$accna1Id = test_input($_POST["id_accna1"]);
$accfi2Id = test_input($_POST["id_accfi2"]);
$accex3Id = test_input($_POST["id_accex3"]);
$accel4Id = test_input($_POST["id_accel4"]);
$accco5Id = test_input($_POST["id_accco5"]);
$accob6Id = test_input($_POST["id_accob6"]);
$accfa7Id = test_input($_POST["id_accfa7"]);
$accsl8Id = test_input($_POST["id_accsl8"]);
$accma9Id = test_input($_POST["id_accma9"]);
$accpl10Id = test_input($_POST["id_accpl10"]);
$accst11Id = test_input($_POST["id_accst11"]);
$accve12Id = test_input($_POST["id_accve12"]);
$accph13Id = test_input($_POST["id_accph13"]);
$accsh14Id = test_input($_POST["id_accsh14"]);
$accth15Id = test_input($_POST["id_accth15"]);
$accot16Id = test_input($_POST["id_accot16"]);
$acccomments17Id = test_input($_POST["id_acccomments17"]);
$injna1Id = test_input($_POST["id_injna1"]);
$injab2Id = test_input($_POST["id_injab2"]);
$injla3Id = test_input($_POST["id_injla3"]);
$injbu4Id = test_input($_POST["id_injbu4"]);
$injbr5Id = test_input($_POST["id_injbr5"]);
$injfa6Id = test_input($_POST["id_injfa6"]);
$injir7Id = test_input($_POST["id_injir7"]);
$injbl8Id = test_input($_POST["id_injbl8"]);
$injfr9Id = test_input($_POST["id_injfr9"]);
$injin10Id = test_input($_POST["id_injin10"]);
$injre11Id = test_input($_POST["id_injre11"]);
$injcr12Id = test_input($_POST["id_injcr12"]);
$injel13Id = test_input($_POST["id_injel13"]);
$injco14Id = test_input($_POST["id_injco14"]);
$injsh15Id = test_input($_POST["id_injsh15"]);
$injot16Id = test_input($_POST["id_injot16"]);
$injcomments17Id = test_input($_POST["id_injcomments17"]);
$bodna1Id = test_input($_POST["id_bodna1"]);
$bodab2Id = test_input($_POST["id_bodab2"]);
$bodba3Id = test_input($_POST["id_bodba3"]);
$bodch4Id = test_input($_POST["id_bodch4"]);
$bodhe5Id = test_input($_POST["id_bodhe5"]);
$bodey6Id = test_input($_POST["id_bodey6"]);
$bodea7Id = test_input($_POST["id_bodea7"]);
$bodno8Id = test_input($_POST["id_bodno8"]);
$bodte9Id = test_input($_POST["id_bodte9"]);
$bodha10Id = test_input($_POST["id_bodha10"]);
$bodar11Id = test_input($_POST["id_bodar11"]);
$bodle12Id = test_input($_POST["id_bodle12"]);
$bodkn13Id = test_input($_POST["id_bodkn13"]);
$bodan14Id = test_input($_POST["id_bodan14"]);
$bodfo15Id = test_input($_POST["id_bodfo15"]);
$bodot16Id = test_input($_POST["id_bodot16"]);
$bodcomments17Id = test_input($_POST["id_bodcomments17"]);
$faidyId = test_input($_POST["id_faidy"]);
$faidnId = test_input($_POST["id_faidn"]);
$faidy_nameId = test_input($_POST["id_faidy_name"]);
$fkityId = test_input($_POST["id_fkity"]);
$fkitnId = test_input($_POST["id_fkitn"]);
$fkity_nameId = test_input($_POST["id_fkity_name"]);
$doctyId = test_input($_POST["id_docty"]);
$doctnId = test_input($_POST["id_doctn"]);
$docty_commentId = test_input($_POST["id_docty_comment"]);
$hospyId = test_input($_POST["id_hospy"]);
$hospnId = test_input($_POST["id_hospn"]);
$hospy_commentId = test_input($_POST["id_hospy_comment"]);
$medic_commentId = test_input($_POST["id_medic_comment"]);
$wit1nameId = test_input($_POST["id_wit1name"]);
$wit1addrId = test_input($_POST["id_wit1addr"]);
$wit1telId = test_input($_POST["id_wit1tel"]);
$wit2nameId = test_input($_POST["id_wit2name"]);
$wit2addrId = test_input($_POST["id_wit2addr"]);
$wit2telId = test_input($_POST["id_wit2tel"]);
$wit3nameId = test_input($_POST["id_wit3name"]);
$wit3addrId = test_input($_POST["id_wit3addr"]);
$wit3telId = test_input($_POST["id_wit3tel"]);
//$submitbyId = test_input($_POST["id_submitby"]);
//$submitbyemailId = test_input($_POST["id_submitbyemail"]);
//$submitbytitleId = test_input($_POST["id_submitbytitle"]);
//$submitbydeptId = test_input($_POST["id_submitbydept"]);
$sexinvolvedId = $maleinvolvedId . $femaleinvolvedId;
$orginvolved = $cjemployId . $othemployId . $contractId . $visitId . $paxId . $publicId;
$location = $apronId . $terminalId . $hangarId . $terminalId . $othlocationId;
$normalduty = $normdutyId . $normdutnId;
$areaclean = $areacleanyId . $areacleannId;
$heating = $heatyId . $heatnId;
$ppeworn = $ppeyId . $ppeyId;
$equipcheck = $equipyId . $equipnId;
$accnature = $accna1Id . $accfi2Id . $accex3Id . $accel4Id . $accco5Id . $accob6Id . $accfa7Id . $accsl8Id . $accma9Id . $accpl10Id . $accst11Id . $accve12Id . $accph13Id . $accsh14Id . $accth15Id . $accot16Id;
$injnature = $injna1Id . $injab2Id . $injla3Id . $injbu4Id . $injbr5Id . $injfa6Id . $injir7Id . $injbl8Id . $injfr9Id . $injin10Id . $injre11Id . $injcr12Id . $injel13Id . $injco14Id . $injsh15Id . $injot16Id;
$bodnature = $bodna1Id . $bodab2Id . $bodba3Id . $bodch4Id . $bodey6Id . $bodea7Id . $bodno8Id . $bodte9Id . $bodha10Id . $bodar11Id . $bodle12Id . $bodkn13Id . $bodan14Id . $bodfo15Id . $bodot16Id;
$firstaid = $faidyId . $faidnId;
$fakused = $fkityId . $fkitnId;
$doctor = $doctyId . $doctnId;
$hospreq = $hospyId . $hospnId;
}
//Sanitise all variables
function test_input($data)
{
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
//Mandatory variable handling, define variables and set to empty values
$nameErr = $emailErr = $posErr = $depErr = $dateErr = $timeErr = $dateErr1 = $timeErr1 = "";
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if (empty($_POST["id_submitby"]))
{$nameErr = "Name is required";}
else
{$submitbyId = test_input($_POST["id_submitby"]);}
if (empty($_POST["id_submitbyemail"]))
{$emailErr = "Email is required";}
else
{$submitbyemailId = test_input($_POST["id_submitbyemail"]);}
if (empty($_POST["id_submitbytitle"]))
{$posErr = "Job title is required";}
else
{$submitbytitleId = test_input($_POST["id_submitbytitle"]);}
if (empty($_POST["id_submitbydept"]))
{$depErr = "Department is required";}
else
{$submitbydeptId = test_input($_POST["id_submitbydept"]);}
if (empty($_POST["id_datereport"]))
{$dateErr = "Date is required";}
else
{$datereportId = test_input($_POST["id_datereport"]);}
if (empty($_POST["id_timereport"]))
{$timeErr = "Time is required";}
else
{$datereportId = test_input($_POST["id_datereport"]);}
if (empty($_POST["id_dateacc"]))
{$dateErr1 = "Date is required";}
else
{$datereportId = test_input($_POST["id_dateacc"]);}
if (empty($_POST["id_timeacc"]))
{$timeErr1 = "Time is required";}
else
{$datereportId = test_input($_POST["id_timeacc"]);}
}
$email = test_input($_POST["id_submitbyemail"]);
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email))
{
$emailErr1 = "Invalid email format";
}
spamcheck($_POST["id_submitbyemail"]);
function spamcheck($field)
{
//filter_var() sanitizes the e-mail
//address using FILTER_SANITIZE_EMAIL
$field=filter_var($field, FILTER_SANITIZE_EMAIL);
//filter_var() validates the e-mail
//address using FILTER_VALIDATE_EMAIL
if(filter_var($field, FILTER_VALIDATE_EMAIL))
{
$submitbyemailId_OK = $field;
return $submitbyemailId_OK;
}
else
{
$submitbyemailId_OK = "Spam email error";
return $submitbyemailId_OK;
}
}
//Check for null or empty variables and assign mysql value
function checkNull($var)
{
if($var == '')
{
$var = '--';
}
else
{
$var = $var;
}
}
//Apply checkNull to variables
checkNull($datereportId);
checkNull($timereportId);
checkNull($nameinvolvedId);
checkNull($addressinvolvedId);
checkNull($telinvolvedId);
checkNull($deptinvolvedId);
checkNull($jobinvolvedId);
checkNull($supinvolvedId);
checkNull($othlocationId);
checkNull($captainId);
checkNull($csId);
checkNull($aircraftId);
checkNull($fltnoId);
checkNull($seatnoId);
checkNull($sectorId);
checkNull($accbyId);
checkNull($relationId);
checkNull($dateaccId);
checkNull($timeaccId);
checkNull($weathercondId);
checkNull($weathercommentsId);
checkNull($equipcommentsId);
checkNull($acccomments17Id);
checkNull($injcomments17Id);
checkNull($bodcomments17Id);
checkNull($faidy_nameId);
checkNull($fkity_nameId);
checkNull($docty_commentId);
checkNull($hospy_commentId);
checkNull($medic_commentId);
checkNull($wit1nameId);
checkNull($wit1addrId);
checkNull($wit1telId);
checkNull($wit2nameId);
checkNull($wit2addrId);
checkNull($wit2telId);
checkNull($wit3nameId);
checkNull($wit3addrId);
checkNull($wit3telId);
checkNull($submitbyId);
checkNull($submitbyemailId);
checkNull($submitbytitleId);
checkNull($submitbydeptId);
checkNull($sexinvolvedId);
checkNull($orginvolvedId);
checkNull($locationId);
checkNull($normaldutyId);
checkNull($areacleanId);
checkNull($heatingId);
checkNull($ppewornId);
checkNull($equipcheckId);
checkNull($accnatureId);
checkNull($injnatureId);
checkNull($bodnatureId);
checkNull($firstaId);
checkNull($fakusedId);
checkNull($doctorId);
checkNull($hospreqId);
//Create mysql connection
$host = '';
$id = 'u1282431_skelly';
$pwd = '';
$db = 'db1282431_healthsafety';
$connection = @mysqli_connect($host, $id, $pwd, $db);
//Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect" . mysqli_connect_error();
}
//Insert entries from form into table
$sql="INSERT INTO healthsafety (datereport, timereport, nameinvolved, sexinvolved, addressinvolved, telinvolved, deptinvolved, jobinvolved, supinvolved, orginvolved, location, othlocation, captain, cs, aircraft, fltno, seatno, sector, accby, relation, dateacc, timeacc, weathercond, weathercomments, normalduty, areaclean, heating, ppeworn, equipcheck, equipcheckcomments, accnature, accother, injnature, injother, bodnature, bodother, firstaid, firstaidby, fakused, fakusedby, doctor, doctorinfo, hospreq, hospinfo, medcomment, wit1name, wit1addr, wit1tel, wit2name, wit2addr, wit2tel, wit3name, wit3addr, wit3tel, submitbyname, submitbyemail, submitbytitle, submitbydept)
VALUES
('$_POST[id_datereport]', '$timereportId', '$nameinvolvedId', '$sexinvolvedId', '$addressinvolvedId', '$telinvolvedId', '$deptinvolvedId', '$jobinvolvedId', '$supinvolvedId', '$orginvolvedId', '$locationId', '$othlocationId', '$captainId', '$csId', '$aircraftId', '$fltnoId', '$seatnoId', '$sectorId', '$accbyId', '$relationId', '$dateaccId', '$timeaccId', '$weathercondId', '$weathercommentsId', '$normaldutyId', '$areacleanId', '$heatingId', '$ppewornId', '$equipcheckId', '$commentsId', '$accnatureId', '$acccomments17Id', '$injnatureId', '$injcomments17Id', '$bodnatureId', '$bodcomments17Id', '$firstaid', '$faidy_nameId', '$fakusedId', '$fkity_nameId', '$doctorId', '$docty_commentId', '$hospreqId', '$hospy_commentId', '$medic_commentId', '$wit1nameId', '$wit1addrId', '$wit1telId', '$wit2nameId', '$wit2addrId', '$wit2telId', '$wit3nameId', '$wit3addrId', '$wit3telId', '$submitbyId', '$submitbyemailId', '$submitbytitleId', '$submitbydeptId');";
//Entry success or failure message
if (!mysqli_query($connection,$sql))
{
//Error message if entry fails
die('Error: ' . mysqli_error($connection));
}
else
{
//output success html page if entries were successfully added:
echo "Entries added";
}
?>
最佳答案
我会尽力向您提供主要概念,然后您可以将其应用到您的案例中。假设您有一个这样的表单:
<form action="path/to/handler/file.php" method="post">
Name: <input type="text" name="name">
Email: <input type="text" name="email">
Phone: <input type="text" name="phone">
<input type="submit" name="submit" value="Submit">
</form>
现在在处理程序文件中:
if (!empty($_POST)) {
foreach ($_POST as $key => $value) {
${$key} = htmlspecialchars(trim($value), ENT_QUOTES, 'UTF-8');
}
}
这段代码将为您提供下一个:
// supposing that the next values are those the user entered
$name = "john doe";
$email = "john.doe@gmail.com";
$phone = "55555555";
现在您可以处理这些变量($name
、$email
和 $phone
)来执行您想做的任何操作,例如检查如果变量为空或不为空,请检查它是否是有效的电子邮件,检查它是否是数字等...然后将它们保存到数据库中。
关于来自表单数据的 PHP 变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20713101/
我在 mongodb 中的玩家和锦标赛之间存在多对多关系。 我希望能够一次将许多玩家添加到锦标赛中。如果没有 ajax,这很简单,但我们有一个包含数千名玩家的数据库,因此表单选择变得巨大。 我们想为此
这个问题已经有答案了: When should I use html's and when spring's in Spring MVC web app? (3 个回答) 已关闭 6 年前。 我正
我正在 C++ Builder XE4 上使用 VCL。 我有以下组件。 FormMain 具有 TButton *B_select; FormSelect(或DialogSelect)具有 TCom
如何在不影响表单控件的情况下更改表单的 alphablend? 德尔福XE7 最佳答案 此问题的一个解决方案是使用多设备应用程序(如果无法使用VCL)。 如果您需要保留透明的TForm,只需更改属性T
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
我正在尝试扩展 Django 注册以包含我自己的注册表单。原则上这是相当简单的。我只需要编写自己的表单( CustomRegistrationForm ),它是原始表单( RegistrationFo
我正在尝试为我的网站实现聊天功能。为了做到这一点,我遵循了以下教程:https://channels.readthedocs.io/en/latest/tutorial/ 然后我稍微更改了代码以实现它
有一个问题,我需要用一个 html 表单提交两个相互关联的模型表单。我知道如何提交两个单独的表格,但是在相关模型表格的情况下外键让我发疯。 问题是,第二个表单应该用外键填充字段到第一个表单的实例。 在
我正在创建一个工具,允许某人输入食谱,然后将其保存为 XML 文件,我已经创建了 XSD,但我想知道如何在我的网页上制作一个表单以允许用户输入他们的食谱并遵守模式。我一直在研究 Ajax 和 Jque
在 .net win 表单(如 asp.net web 表单)中是否有可用的验证控件? 因为很难为我的每个控件设置正确的条件,所以我的表单中也有很多重复的代码。 正确的做法是什么? 最佳答案 看看这个
我有一个简短的问题。我正在学习如何使用 javascript 制作注册表,发现此链接非常有用。 http://www.w3resource.com/javascript/form/javascript
我正在开发一个项目,该项目将使用循环将许多表单添加到 mysql 数据库中。在 javascript 部分中,我无法让 var i 在函数 updatesum() 中工作。有人可以帮我吗? 我试图避免
在我的应用程序上有一个包含 2 个字段和一个保存按钮的表单。 在我的 onClick 结束时我需要什么来将光标返回到第一个字段。 我有这个来清除它们 txtData.setText("
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况有关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
<input type="text" name="textfield" onKeyPress="javascript:alert(event.
我正在构建的网站有一个登录表单,作为所有其他模板扩展的 base.html 模板的一部分;因此,我需要以某种方式处理每个页面上的登录/注销逻辑。 目前每个页面都在单独的 View 中加载,那么实现它的
我有一个表单类,看起来像.. #forms.py class ExampleForm(forms.Form): color = forms.CharField(max_length=25)
有没有办法在表单定义中给表单一个特殊的错误渲染函数?在 customizing-the-error-list-format 下的文档中它展示了如何为表单提供特殊的错误呈现函数,但似乎您必须在实例化表单
我正在处理由多个页面组成的表单,我想解决验证问题。 当我点击提交按钮时,当前页面上的所有字段都会在下方显示错误消息,但是如果我更改页面,那么我需要再次点击提交,因为这些字段未设置为已触摸。 如果我可以
是否可以附加到继承表单的 exclude 或 widgets 变量? 到目前为止,我有以下设置。 class AddPropertyForm(forms.ModelForm): num_mon
我是一名优秀的程序员,十分优秀!