By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,850 Members | 1,895 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,850 IT Pros & Developers. It's quick & easy.

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

P: 93
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
Share this Question
Share on Google+
2 Replies


acoder
Expert Mod 15k+
P: 16,027
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
Expert Mod 15k+
P: 16,027
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.