我創建了一個表單,其中根據選擇顯示/隱藏輸入字段,並且我只發佈可見的輸入字段。目前隱藏的輸入字段的值也submitten不要發佈隱藏的表單輸入字段?
我檢查了$ _ POST,我看到
[chairs] => Array
(
[0] => chair-b-white
[1] => chair-c-black
)
[num_of_chair-a-black] =>
[num_of_chair-a-white] =>
[num_of_chair-a-gray] =>
[num_of_chair-b-black] =>
[num_of_chair-b-white] => 2
[num_of_chair-b-gray] =>
[num_of_chair-c-black] => 5
[num_of_chair-c-white] =>
[num_of_chair-c-gray] =>
有沒有辦法跳過它們是空的張貼輸入字段?
你可以用JavaScript來做到這一點。你已經使用JS庫嗎? – Jasper 2014-09-26 09:57:16
@Jasper是的,jquery + bootstrap + bootstrapvalidator。順便說一下,我隱藏/顯示由'$(「#椅子」)div divs。change(function(){ $('。hide-el-chairs')。hide(); $(「#chairs option: ()。('。num_of_'+ str())。 +「_label」)。show(); }); });' – alex 2014-09-26 10:00:57