• 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: Add text in hidden field from a selected list

Add text in hidden field from a selected list 10 years 10 months ago #28109

  • betrained
  • betrained's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 1
2 fields :
- a selected list (value#1|text#1, value#2|text#2...)
- an hidden field

How can I use the getElementById javascript command the get the TEXT part of the selected list in a hidden field instead of the VALUE ?
The administrator has disabled public write access.

Add text in hidden field from a selected list 10 years 10 months ago #28110

  • betrained
  • betrained's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 8
  • Thank you received: 1
Here is the solution that I found.
2 fields :
- "field#1" (selected list) with value#1|text#1, value#2|text#2...
- "field#2" (hidden field)

A script to add in the CSS/javascript section :
<script type="text/javascript">
 
  function copyText(){
  document.getElementById('field#2').value = document.getElementById('field#1').options[document.getElementById('field#1').selectedIndex].text ;}
 
</script>

Attached to the selected list in additional attributes :
onchange="copyText();"

Et voilà...
Last Edit: 10 years 10 months ago by betrained.
The administrator has disabled public write access.
The following user(s) said Thank You: jan_matglas_com
  • 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!