|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi all,
I need a help desperately. what I have been trying to do is in user control (mycontrol.ascx) I would like to validate dropdownlist using client-side javascript(not server side) so what I did was <SCRIPT> function validate_form_step2() { val selectedval = document.forms (0).mydropdown.selectedIndex; alert(selectedval); } </script> but it didn't show any value and keeping saying error occured. and also in seperate page when I open a popup windows in user control and when I close the popup windows I would like to refresh the parent windows so I did like <a href="" onclick="javascript: opener.location.refresh();"> somebutton </a> But it doesn't refresh it. what could be wrong? Looking forward to hearing from you guys, Good day!! |
|
#2
|
|||
|
|||
|
Try:
<a href="" onclick="javascript: window.opener.location.reload();"> somebutton </a> |
|
#3
|
||||
|
||||
|
To answer your first part - Javascript refers to array elements with square [] brackets. (Most languages do - ASP/VB bad!)
Also, the SELECT list property .selectedIndex will only get the options selected index (!) - not the value. To get the value: document.forms[0].mydropdown.options[document.forms[0].mydropdown.selectedIndex].value It's got to be the most verbose bit of code around. PS - there is a forum specifically for JS now |
|
#4
|
|||
|
|||
|
Thanks guys!! Greate help
Thanks,stumpy, numbernine but my real problem is (sorry, reload works fine by the way) say you open a web form which contains a web user control and through that user control you create a popup windows which has a textbox. Basically, I would like to send whatever value in the textbox in the popup windows to the textbox in the web user control using javascript. something like this window.opener.webformForm1.web_user_control_textbo x1.value = document.popupForm1.textbox1.value if you use this javascript for php or asp it should work however, since I am using web user control, it seems to work in a different way Any Idea guys!! |
|
#5
|
||||
|
||||
|
You're getting confused between server-side and client side. You can't pass values between windows dynamically like you're talking about with a server-side language like ASP or PHP.
Using JS, you'd do something like: window.opener.webformForm1.textbox1.value = document.forms[0].textbox1.value |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > Client-side & server-side javascript |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|