• 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: Auto attach pdf from select box

Auto attach pdf from select box 1 week 3 days ago #43426

I've got a form which asks for references and the admin can choose an attachment from a select box. This works fine but can I auto-select the attachment from the select box to prevent admins from selecting the wrong one?
The administrator has disabled public write access.

Auto attach pdf from select box 1 week 1 day ago #43430

  • iceferret
  • iceferret's Avatar
  • OFFLINE
  • Gold Boarder
  • Posts: 216
  • Thank you received: 57
As an example and without knowing what your fields are called here's a Javascript function that will synch field2 with field1, number of options in the fields can be any but they must be equal.
try it in a test form, create field1 with 4 options 1-4 and the same for field2 , note field names have no spaces.
<script>
  function synchronizeFields(field1Id, field2Id) {
  var field1 = document.getElementById(field1Id);
  var field2 = document.getElementById(field2Id);
 
  if (!field1 || !field2) {
    console.error('Fields not found');
    return;
  }
 
  field1.addEventListener('change', function() {
    field2.value = field1.value;
  });
}
 
// Usage:
synchronizeFields('field1', 'field2');
</script>

call the function in field1/attributes with
onInput="synchronizeFields('field1', 'field2');"
If you can keep your head when all about you are losing theirs, then you obviously don't understand the situation!
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!