Solved

Copy current address in Permanent address using javascript

Posted on 2010-08-30
3
2,678 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
ID: 33557332
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
ID: 33557888
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
ID: 33558250
Thanks.That's exactly what I was looking for.
Thanks to all.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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 code hide show and toggles. 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…

829 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