0

I have 2 address fields : Res. addr and Permanant addr. On clicking another field : same as above

I want to copy all the values entered in Res. addr to Permanant addr.

Please let me know how to do it?

Thanks, ronforever

2

2 Answers 2

2

There is no simple solution, and therefore I'm not sure this question is good for the Drupal Stack Exchange. It's going to be a matter of custom JavaScript or AJAX Form API code, and it will be dependent on how you're using Address Field and what sort of form you're integrating it into.

Based on the comments below, though, I'd add that there's nothing particularly challenging about this. If both sets of form elements are on the same page, it's a simple matter to use JavaScript (especially with jQuery) to copy the data from one form field to the next. There just isn't a simple property to toggle within the form API code itself.

4
  • This is a realistic problem that could be of use to a wide audience. An answer that outlines why something isn't possible, or summarizes the difficulties, is perfectly acceptable.
    – mpdonadio
    Commented Jun 20, 2013 at 1:24
  • If I understand StackExchange correctly, that's just not how the tool is supposed to be used. I'm all for that sort of documentation happening, but there's really nothing for it than to use regular ol' JavaScript to copy fields from one part of the DOM to another. So, it's possible, there are no real difficulties... not sure what else needs to be said. : ) Commented Jun 22, 2013 at 0:50
  • I get what you are saying, but if you just look at the question itself from a non-developer's point of view, they may not know that there isn't a simple solution. My approach as mod is to try to judge on-topic / off-topic solely on the question, and then let the answers come. This is the reason for leaving it open. Other mods or the community may disagree and close this out. BTW, thanks for stopping by to answer UC and Commerce questions.
    – mpdonadio
    Commented Jun 22, 2013 at 13:09
  • No worries, happy to help. : ) Commented Jun 22, 2013 at 22:44
0

I had the same problem and my solution was to use RULES. I have to address fields on my node, one is the registration address of a particular company a the other address field is the standard shipping address.

So in my case I have made the shipping address field not mandatory and if its empty a RULE i triggered which copies the address from the other field.

1
  • Would you mind adding an export of that rule to your answer? Commented Aug 22, 2016 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.