get paid to paste

Post

Hello everyone!

So, this was bugging me for a while. I just want to change the style of a button to visible = true / false, because if I hide it/show it using a question event I loose the default value and can't set it using another question event unlike a textbox.

I'm aware that a token, for example $(MyButton) is just an abbreviation of document.getElementById('dnn_ctr520_DynamicForms_btn_GUIDbe00093b-9da9-48c5-bda4-2518c7f388c9').value

So, I just want to change that .value into .style.visible like this:

function IdFromToken(token){

var bruja = token.replace("document.getElementById('","");
bruja = bruja.replace("').value","");

return bruja;
}

document.getElementById(IdFromToken($(MyButton))).value = 'HELLO!';

meaning that, if that works:

document.getElementById(IdFromToken($(MyButton))).style.visibility = 'hidden';



That should change my button text to "HELLO!" (without the quotes) but for some reason it doesn't.

The thing is, is there any better way to do this? Meaning.. to get the element from an ID? I already tried getElementById(MyButton) as I found in the forum but it didn't work =(.

I just happen to do this function which is a really horrible solution but I don't have a lot of time to play around with tutorials and stuff and I wanted to "code my way to victory" =P


Thanks in advance!

Pasted: Oct 19, 2011, 12:52:04 pm
Views: 13