/    Sign up×
Community /Pin to ProfileBookmark

set value of hidden field

hi!

i got a hidden field : [COLOR=green]<html:hidden property=”addThisUser2Group” value=””/>[/COLOR]

and i want to set the value of this field to “userArray”

[COLOR=green]<html:form action=”jsp/addUser2Group.do” focus=”username” onsubmit=”getThisUsers();”>[/COLOR]

this is my getThisUsers() function:
[COLOR=green]function getThisUsers()
{
var userArray = top.parent.foundUsers.getUsers2AddJS();
document.addThisUser2Group.value = userArray;
}[/COLOR]

it just shows me all the time this error: ‘document.returnedUser.addThisUser2Group.value’is null or not an object

can somebody tell me what i am doing wrong?

thank you for your help!

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@CharlesOct 28.2004 — Since you're not using HTML things get a little complicated and it is hard to figure out what is going on without the entire document but it looks like you are trying to use DOM level 1, chapter 2. DOM level 1, chapter 2 is reserved for HTML so you'll want to use DOM level 1, chapter 1. Give your element an "id" of say "addThisUser2Group" and assign to [font=monospace]document.getElementById('addThisUser2Group').value[/font].
Copy linkTweet thisAlerts:
@7studOct 28.2004 — document.[color="red"]returnedUser[/color].addThisUser2Group.value is null or not an object

1)Where is [color="red"]returnedUser[/color]?

2)top.parent --> I don't think there is such a thing. How can something be 'top' if it has a parent?
Copy linkTweet thisAlerts:
@grillauthorOct 28.2004 — charles, you're right! getElementById works!

thank you guys!
×

Success!

Help @grill spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...