Hi,
I'm having a small problem with setting the value of a hidden form field in the customUserCreateForm extension. The alert gives the correct value, but somehow it doesn't get posted after the user created a new account.
The value of the hidden value has to be set when someone checks a checkbox.
<input type='checkbox' name="wpFacultyCheck" onChange="createUserToggle(this)" id="wpFacultyChecker" />
<input type="hidden" id="hiddenFacultyField" name="hiddenFacultyField" value="" />
Then in common.js I have:
function createUserToggle(obj){
if(obj.checked){ document.userlogin2.hiddenFacultyField.value="yes"; }else{ document.userlogin2.hiddenFacultyField.value="no"; } alert(obj.value +" "+ document.getElementById('hiddenFacultyField').value) }
addOnloadHook(createUserToggle);
I used "onchange" as "onclick" doesn't work in FF3.
Does anyone have a good solution for this?
Thanks,
Alain
Alain wrote:
Hi,
I'm having a small problem with setting the value of a hidden form field in the customUserCreateForm extension. The alert gives the correct value, but somehow it doesn't get posted after the user created a new account.
The value of the hidden value has to be set when someone checks a checkbox.
<input type='checkbox' name="wpFacultyCheck" onChange="createUserToggle(this)" id="wpFacultyChecker" />
<input type="hidden" id="hiddenFacultyField" name="hiddenFacultyField" value="" />
Then in common.js I have:
function createUserToggle(obj){
if(obj.checked){ document.userlogin2.hiddenFacultyField.value="yes"; }else{ document.userlogin2.hiddenFacultyField.value="no"; } alert(obj.value +" "+ document.getElementById('hiddenFacultyField').value) }
addOnloadHook(createUserToggle);
I used "onchange" as "onclick" doesn't work in FF3.
Does anyone have a good solution for this?
Thanks,
Alain
Try using DOM: document.getElementById('hiddenFacultyField').value="no";
Although you can probably fix your extenxion to take into account the value in the checkbox instead of hidden fields and javascript.
Hi Platonides,
I tried it with getElementById before and that didn't work either. Checking for the value on the checkbox does the trick indeed. All working now.
Thanks,
Alain
Platonides wrote:
Try using DOM: document.getElementById('hiddenFacultyField').value="no";
Although you can probably fix your extenxion to take into account the value in the checkbox instead of hidden fields and javascript.
mediawiki-l@lists.wikimedia.org