我的 symfony 应用程序有这个实体:
\n<?php\n\nnamespace App\\Entity;\n\nclass Lead\n{\n private ?string $zipCode;\n private ?string $city;\n\n public function getZipCode(): ?string\n {\n return $this->zipCode;\n }\n\n public function setZipCode(string $zipCode): self\n {\n $this->zipCode = $zipCode;\n\n return $this;\n }\n\n public function getCity(): ?string\n {\n return $this->city;\n }\n\n public function setCity(string $city): self\n {\n $this->city = $city;\n\n return $this;\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n表单LeadType为:
\n$builder->add(\'zipCode\', TextType::class, [\n \'attr\' => [\n \'placeholder\' => \'Ex : 44000\',\n \'onchange\' => \'cityChoices(this.value)\',\n ]\n ])\n ->add(\'city\', ChoiceType::class, [\n \'choices\' …Run Code Online (Sandbox Code Playgroud)