• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3067
  • Last Modified:

Copy current address in Permanent address using javascript


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
johny_bravo1
Asked:
johny_bravo1
1 Solution
 
Kevin CrossChief Technology OfficerCommented:
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
 
Astynax777Commented:
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
 
johny_bravo1Author Commented:
Thanks.That's exactly what I was looking for.
Thanks to all.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now