SitePoint Sponsor |
|
User Tag List
Results 1 to 9 of 9
-
Oct 21, 2006, 14:34 #1
- Join Date
- Mar 2005
- Posts
- 166
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
How to add new values into a select option list
Hello all,
Someone could guide me to a code that inserts new values into a select option input on parent form via popup..
I tried the codes below already..
function sendInfo(pat)
{
opener.forminclui.tipo_chamado.options.text = pat;
opener.forminclui.tipo_chamado.options.value = pat;
self.close();
}
>>> In this case nothing happens...
function sendInfo(pat)
{
opener.forminclui.tipo_chamado.options = pat;
self.close();
>>> In this case the change field only works if using a text input...whn using select inputs, it changes to blank...
-
Oct 21, 2006, 16:02 #2
- Join Date
- Sep 2006
- Posts
- 731
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by mjunior
-
Oct 21, 2006, 16:33 #3
- Join Date
- Mar 2005
- Posts
- 166
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I'm kind of lost..could you help me?
I tried
function sendInfo(pat)
{
opener.forminclui.tipo_chamado.options[1] = new Option(pat,pat);
self.close();
}
Also nothing happens..
-
Oct 21, 2006, 16:59 #4
- Join Date
- Sep 2006
- Posts
- 731
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by mjunior
opener.document.forms.forminclui.tipo_chamado.options[1]
I assume you are getting no console errors?
-
Oct 21, 2006, 17:18 #5
- Join Date
- Mar 2005
- Posts
- 166
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
still the same..
Yes, the "forminclui" is the form name from my parent page...
In this form has a window.open link to open a popup..
In a popup I do a few rs researching and insert new data into my db..
Then I'd like to send this new value added back to my parent form (inside my select option list)..but without reloading the page..
As I said..I did the test using the sendInfo function pointing to text fields and the new data appears into the field normaly...
Using the reference you sent to the parent page..the situation is the same,when I call the funtion by the OnClick method..nothing happens..Last edited by mjunior; Oct 21, 2006 at 17:54.
-
Oct 21, 2006, 17:59 #6
- Join Date
- Sep 2006
- Posts
- 731
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by mjunior
Code:new opener.Option(...)
-
Oct 21, 2006, 18:10 #7
- Join Date
- Mar 2005
- Posts
- 166
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
still nothing
Thanks for the quick reply..but I got nothing so far from this code:
function sendInfo(pat)
{
opener.document.forms.forminclui.tipo_chamado.options[1] = new opener.Option( pat,pat);
self.close();
}
-
Oct 21, 2006, 18:38 #8
- Join Date
- Sep 2006
- Posts
- 731
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by mjunior
The solution is to have a function in the opener that updates the select.
Code:function updateSelect(s) { document.forms.forminclui.tipo_chamado.options[1]=new Option(s,s); }
Code:opener.updateSelect(pat,pat)
-
Oct 21, 2006, 21:57 #9
- Join Date
- Mar 2005
- Posts
- 166
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Very tricky!!!
Thanks mate..
I also added the focus to that select...
opener.forminclui.tipo_chamado.focus();
Bookmarks