JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript 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 22nd, 2006, 05:18 AM
dukey100 dukey100 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2006
Location: London
Posts: 3 dukey100 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 33 sec
Reputation Power: 0
Arrow Dynamically moving dataon a page

Hi there,

I have a form (in ASP) that has three objects.
When the page loads the combo box fills up with information about members details: NAME and AGE. The two text boxes are empty.


1> drop down combo box (date: name and age)
2> text input box
3> 2nd text input box

What I need to do



When a user selects a member from the drop down box, I want the information in the drop down box to automatically appear in the two text boxes.

The NAME must go in the first text box.
The AGE must go in the second text box.

I am not sure is I need a JavaScript function to do this?

Would appreciate any advice. Thanks.

Reply With Quote
  #2  
Old May 22nd, 2006, 11:20 AM
ravs ravs is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Location: gurgaon, haryana, india
Posts: 60 ravs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 44 m 29 sec
Reputation Power: 3
Send a message via Yahoo to ravs
Lightbulb

hey dukey


first tell the how you will bring the data of select change of combo .
because javascript will not go to server. and as u said that you have dynamically filled combo.

so do one thing cache the data in javascript at the same time in when u fill the combo box, or set user defined attributes. when u will see the rendered code it will look like

<select>
<option value="some Value" userdefinedAttrName="some value" userdefinedAttrAge="some value">display value</option>
</select>


then use this function on select change

function fn_InsertMyValues(e,txtName,txtAge)
{
if(e.options.selectedIndex!=0)// if no values on index 0
{
document.getElementById(txtName).value=e.options[e.options.selectedIndex].userdefinedAttrName
document.getElementById(txtAge).value=e.options[e.options.selectedIndex].userdefinedAttrAge;
}
}


enjoy

Reply With Quote
  #3  
Old June 15th, 2006, 12:17 AM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 473 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 19 m 14 sec
Reputation Power: 3
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
if your taking it this way...

you could you cookies to store info and getinfo from, although it may be deleted by user... anyway the helpful cookie coding is...

function getCookie( name ) {
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}

function setCookie( name, value, expires, path, domain, secure ) {
var today = new Date();
today.setTime( today.getTime() );
if ( expires ) {expires = expires * 1000 * 60 * 60 * 24;}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name+"="+escape( value ) +
( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

function deleteCookie( name, path, domain ) {
if ( getCookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

Reply With Quote
  #4  
Old June 16th, 2006, 02:53 AM
ravs ravs is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Location: gurgaon, haryana, india
Posts: 60 ravs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 44 m 29 sec
Reputation Power: 3
Send a message via Yahoo to ravs
only one thing to say that cookies are old methods and quite obselete. and now a days due to hacking client user normally disable the cookie so u will stay on the mercy f t he client user

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Dynamically moving dataon a page


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 5 hosted by Hostway
Stay green...Green IT