私はjsでフォームを作成するのが初めてです。少しのコードをコピーして適用し、選択したラジオ ボタンに応じてフィールドがポップアップするようにしました。これは 2 つのラジオ ボタンでうまく機能しますが、いくつか (5 つ以上) を含める必要があり、変更のたびにフィールドをリセットしたいという問題があります。
追加のコードを入力してすべてのフィールドを「onchange」にリセットできると思っていましたが、このコードを機能させることができません...使用するためにコピーして変更したものは次のとおりです。
設計どおりの2つのボタンでうまく機能します:
{
toggleSelectionFields: function() {
var isLaptop = ca_fdIsSelectRadio('showhide','group','short');
if (isLaptop) {
ca_fdHideField('showhide','longfields');
ca_fdShowField('showhide','shortfields');
} else {
ca_fdHideField('showhide','shortfields');
ca_fdShowField('showhide','longfields');
}
}
}
これが私がやろうとしたことです:
{
toggleSelectionFields: function() {
Var discovery = ca_fdIsSelectRadio('phone','deskphone4610','selectproblem','SelectIssue','discovery');
Var headset = ca_fdIsSelectRadio('phone','deskphone4610','selectproblem','SelectIssue','headset');
Var fac = ca_fdIsSelectRadio('phone','deskphone4610','selectproblem','SelectIssue','feature');
Var calls = ca_fdIsSelectRadio('phone','deskphone4610','selectproblem','SelectIssue','calls');
if (discovery)
{ca_fdShowField('phone','deskphone4610','selectproblem','discovermode')}
if (headset)
{ca_fdShowField('phone','deskphone4610','selectproblem','headset')}
if (fac)
{ca_fdShowField('phone','deskphone4610','selectproblem','feature')}
if (calls)
{ca_fdShowField('phone','deskphone4610','selectproblem','calls')}
}
}
}