Home/Support/Support Forum/javascript getElementById
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

javascript getElementById

0 votes
I'm using the advanced web server and am starting to be frustrated. Is there a way to set misc text items into <INPUT> statements, such as id=<myid>. The pbuilder seems to filter out a lot of tags. The "Name" property of the <FORM> seems to also get filtered.

Any suggestions or ideas?

Thanks,
Eric
asked May 31, 2007 in NET+OS by ezimmerman New to the Community (9 points)
recategorized Dec 18, 2013 by tuxembb

Please log in or register to answer this question.

7 Answers

0 votes
<!-- RpFormHeader NAME=dlf0 ID=lf0 RpFunctionPtr=ApplyDataLogViewSelection RpDirect -->
<FORM NAME="lf0" ID="lf0" action="view_datalog.html" method="POST">
<!-- RpEnd -->

This worked fine for me
answered Jun 6, 2007 by Adrian New to the Community (46 points)
0 votes
Ok... I guess I was looking through "View Source", but even with working webpages, it does not show IDs in the code...

The real question has to do with RpRadioButtonGroup. How do I change the selected radio button through javascript?

document.FwEnableGroup.checked is not a valid option.

Thanks,
Eric
answered Jun 6, 2007 by ezimmerman New to the Community (9 points)
0 votes
Inside the group you shoud have one RpFormInput for each Radio button (with TYPE=RADIO of course). They all should have the same NAME as the group. Each radio button will have a VALUE=0,1,2... different for each radio button.
Int the Get/Set functions declared in RpRadioButtonGroup, you can set/read the value of the checked button. (If you return the proper value from the Get function, it will check the corresponding button). Set function lets you retrieve the checked button.

Adrian
answered Jun 6, 2007 by Adrian New to the Community (46 points)
0 votes
Get and set won't happen until a post though, right?
When I click on one of the radio buttons in my browser, it is not going to communicate anything with the digi until post or refresh, correct?

Basically, I'm trying to disable some inputs or buttons when one of the radio buttons is selected and enable when the other one is selected.

Also, I would like to validate items prior to post.
answered Jun 6, 2007 by ezimmerman New to the Community (9 points)
0 votes
Get happens whenever you are loading the page. Set happens only after a post.

For your problem, declare one (or more) Javascript varriable(s) and call a JS function which will enable/disable your items according to the value(s) of variables.
The variable values will be modified whenever you load or reload the page. You can use a RpDisplayText function for this which will modify the values according to your internal variables. In this way you will have the desired enabling when loading the page.

Additionally, you can use onClick() JS function to enable/disable things when you just switch radio buttons without pressing Submit.

Adrian
answered Jun 7, 2007 by Adrian New to the Community (46 points)
0 votes
right... that's what I have been trying to do.

I have a function called in onclick(), but I keep receiving errors when I try to check and set form items... invalid objects, etc.

Does anyone have an example of doing this?

Thanks,
Eric
answered Jun 7, 2007 by ezimmerman New to the Community (9 points)
0 votes
I still couldn't get the radio ID property to work right, but I don't why I didn't think of this before...

I pointed each radio button to a seperate function and passed the object through. These worked!

function enable_fw(obj)
{
if (obj.checked==true)
document.getElementById('fwport').disabled=false;
else
document.getElementById('fwport').disabled=true;
}

function disable_fw(obj)
{
if (obj.checked==true)
document.getElementById('fwport').disabled=true;
else
document.getElementById('fwport').disabled=false;
}
answered Jun 8, 2007 by ezimmerman New to the Community (9 points)
...