ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old May 8th, 2003, 07:28 PM
yootaeho yootaeho is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Australia
Posts: 2 yootaeho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Client-side & server-side javascript

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!!

Reply With Quote
  #2  
Old May 9th, 2003, 11:53 AM
numbernine numbernine is offline
Up To His Eyes In Ads
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Chicago
Posts: 160 numbernine User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 25 sec
Reputation Power: 6
Try:
<a href="" onclick="javascript: window.opener.location.reload();"> somebutton </a>

Reply With Quote
  #3  
Old May 10th, 2003, 07:26 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
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
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
  #4  
Old May 10th, 2003, 07:20 PM
yootaeho yootaeho is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Australia
Posts: 2 yootaeho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!!

Reply With Quote
  #5  
Old May 11th, 2003, 12:22 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Client-side & server-side javascript


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway