Solved

Copy current address in Permanent address using javascript

Posted on 2010-08-30
3
2,511 Views
Last Modified: 2012-05-10

Hi Experts,
I am using cascading dropdowns, for Country,State,City.
I have written a web service for this.
I have to add different dropdowns for Country-State-City as for Current address and Permanent Address.
This works well.
Now I need to copy the current address with checkbox click(Current address is same as Permanent)
I have written a javascript to set the values,but for dropdowns it is not working.
Do I need to call the web method in  web service from javascript?How?
Or is there any other way?
Thanks for your time.Your help is really appreciated.
Address.JPG
0
Comment
Question by:johny_bravo1
3 Comments
 
LVL 59

Expert Comment

by:Kevin Cross
Comment Utility
Since you asked for an alternative and think the issue you will have is that the values of those drop downs will not have even been filled yet; therefore, you can try this:

For the drop-downs have a textbox next to them that is the selected value (you can use JavaScript on selection change for drop down to fill the box) and read the value from this box on your page that handles the submit.  So the drop-down boxes just become a mechanism for consistent entry that is validated against the db.  You can make the textbox disabled from user entry, so as to protect this.  

Now when you check the box, all you have to do is fill the normal textboxes with values from Permanent which you can trust since they came from selection using drop downs.

Hope that makes sense.
0
 
LVL 3

Accepted Solution

by:
Astynax777 earned 500 total points
Comment Utility
Here's a solution...

$find the cascading drop-down behavior and then call set_SelectedValue
You should then raise the onParentChange event so it will populate the next.
var behavior = $find("<cascadingDropDownBehaviorID>");

behavior.set_SelectedValue(value);

behavior._onParentChange(null, true);



var behavior2 = $find('<nextCascadingDropDownBehaviorID>');

behavior2.set_SelectedValue(value); 

behavior2._onParentChange(null, true);

//etc...

Open in new window

0
 
LVL 8

Author Closing Comment

by:johny_bravo1
Comment Utility
Thanks.That's exactly what I was looking for.
Thanks to all.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now