• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Modal Form JS to access element in parent wondow

Modal Form JS to access element in parent wondow 10 years 11 months ago #27802

  • tobypsl
  • tobypsl's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 62
  • Thank you received: 1
Hi

I had a form in a module and was using this javascript to populate the recipient field for an admin email:

<script type="text/javascript">
jQuery(document).ready(function test() {
    jQuery('#sendto').val(jQuery('.element-4732132c-bbbb-4f11-8179-8fa38301d8a9').text());
});
</script>

This works nicely. The script pulls the value of an element on the page and puts it into a hidden field 'sendto' on the form. This hidden field is then used to populate the recipient address.

But when I put the form inside a modal window it doesn't work. I'm guessing the problem is to do with how the element on the parent page is referenced.

I tried replacing 'document' with 'window.parent.document' and 'window.top.document' but neither work.

Any ideas on what I may need to tweak in the JS?

Thanks.
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!