0
私は動的に生成された生徒のリストを持っています。私は、ユーザーが出席を捉え、もしそれがなければ、それが許されているかどうかを欲しい。存在する場合、後者を記録する理由はなく、そのオプションを無効にします。動的要素リストのフォーム要素を有効にします
私の問題は、出席を取るためのフォーム要素(djangoテンプレートとGoogleアプリケーションエンジン経由)を含むようにリストが動的に生成されることです。
私はexcused/unexcusedラジオボタンを有効/無効にするためにjavascriptを使用していますが、そうする良い方法を理解できません。それは正しい変数の使い方の単純な問題だと思われますが、私はそれを理解することができません(そして、私はよく知っている言語ではありません)。
のjs関数の中で次のことをしようしようとしているイム:
//bring the name and ID of the clicked element in to the function
function disable_enable(rdoIdIN, rdoNameIN){
//create a simple string of the common portion of the submitting button Im looking for, the word, "absent"
var rdoId = rdoIdIN.substring(0,6);
//use the dynamic portion of the clicked element name to generate the dynamic name of the element I want to enable
var rdoStatusName = 'attendcategory' + rdoNameIN.substring(10)
if (document.formname.rdoID == 'absent'){
//enable the excused/unexcused elements
document.formname.rdoStatusName[0].disabled=false;
document.formname.rdoStatusName[1].disabled=false;
}
これはダイナミックなフォームの内容で日常的な問題になるようだが、私は解決策を見つけることに成功していません。
おかげで、完全に働きました。 – techkilljoy