Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 686
  • Last Modified:

Forms and Javascript


Hi Experts,

I have an options form on a JSP that consist of multiple radio buttons, i'm trying to use javascript and i'm having trouble finding the property because the form uses transfer beans if name a property

<html:radio proptery="mytransferbean.getFormAttrubite" value="true" onClick=callJavaScript/>

 as opposed to putting all the form attributes in the form directly

<html:radio proptery="getFromAttrubite" value="true" onClick=callJavaScript/>

My javascript doesnt like nested names so

document.myForm.mytransferbean.getFormAttrubute

isnt found

Any ideas on  how to solve this problem????  I've tried using

document.myForm.element[1] etc but because the form is quite large its to many elements to manage.

Thanks!
Fynzy
0
fyness
Asked:
fyness
  • 3
  • 2
1 Solution
 
KuldeepchaturvediCommented:
gerElementByName("mytransferbean.getFormAttrubite");
0
 
owenli27Commented:
You could directly pass radio object to Javascript function .
<html:radio proptery="mytransferbean.getFormAttrubite" value="true"  onClick="callJavaScript( this )"/>

function callJavaScript (obj) {
    alert(obj.value);
}
0
 
fynessAuthor Commented:

if i use getElementByName("")  if i have 2 properties the same, both radio buttons can i call each one as normal

document.getForm.getAttrubiteRadio[0]
document.getForm.getAttrubiteRadio[1]

Thanks,
Suzy
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
KuldeepchaturvediCommented:
yes you should be able to do that... if there are more objects of the same name, the fuction returns an array of objects.
0
 
fynessAuthor Commented:

when i use getElementByName i get the following javascript error in firefox

document.myForm.getElementByName is not a function
0
 
fynessAuthor Commented:

Got it working!

works with

document.getElementsByName("")

Thanks!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now