469,612 Members | 1,674 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,612 developers. It's quick & easy.

'Create popup and return value' code working for one button but not another

Hi, I have created a pop up using js and returns a value for me to process. I have got it working. I now need to do it again for another button. The value return will be processed differently. But as i need to get the value out the same way i decide to use whats already there. The problem is it works for the original one and breaks for the new one. My code is bellow. It seems to break on theform.elements[id].value. it does not like id i think.Like i said it works for one and not the other why?. from the alerts it is pass the right stuff through

CODE:

Expand|Select|Wrap|Line Numbers
  1. function SetUser(formName, id, newvalueid, postBack)
  2. {
  3.    alert(id);
  4.    alert(formName);
  5.    alert(newvalueid);
  6.    alert(postBack);
  7.     eval('var theform = document.' + formName + ';');
  8.     popUp.close();
  9.     alert(theform);
  10.     theform.elements[id].value = newvalueid;
  11.     if (postBack)
  12.         __doPostBack(id,'');
  13. }
Oct 20 '08 #1
2 1343
acoder
16,027 Expert Mod 8TB
As a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use the tags in future.

Please also remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).

This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions. Thanks

Moderator.
Oct 20 '08 #2
acoder
16,027 Expert Mod 8TB
Post your form HTML code too. It seems that you're mixing the name and ID.
Oct 20 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Doug O'Leary | last post: by
2 posts views Thread by Kiyomi | last post: by
2 posts views Thread by jackson2005 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.