Unfortunately, the username and password you have entered do not match!

Registration

Unfortunately, this username is already taken!

Unfortunately, this e-mail address is already used!

Please retype the verification code.

All fields are required

How to hide textbox not after checking chechbox

Welcome, Guest
Username Password: Remember me

How to hide textbox not after checking chechbox
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: How to hide textbox not after checking chechbox

How to hide textbox not after checking chechbox 1 year, 8 months ago #10541

  • Oleg
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
Hi everyone!

I've read this topic in the tutorial (www.rsjoomla.com/customer-support/docume...-or-hide-fields.html) and now I can show or hide some textbox AFTER clicking on radio component.
But my question is: can I hide some textbox NOT AFTER clicking on radio component BUT BEFORE such clicking.
For example, let’s suppose that my radio component is named: "Radio" with the following configuration:

Items:
val1|Description1
val2|Description2
(and both of this items are NOT selected in the initial state of the form).
And suppose that I have two textboxes “Textbox1” and “Textbox2”.
I wish in the first opening of the form to be only radio group “Radio” with two unselected items: val1 and val2 (and two hidden textboxes).
And only after I’ll select one of the radio item, the appropriate textbox will be shown (“Textbox1” if I’ll select val1 and “Textbox2” if I’ll select val2).
Can someone help me to hide textboxes in the opening of the form?
Thank you in advance!
Sorry for my English.

Re:How to hide textbox not after checking chechbox 1 year, 8 months ago #10569

  • andreic
  • OFFLINE
  • Moderator
  • Posts: 494
Hello,

In order to achieve this you could try changing the script so that the fields will be hidden when the page is loaded and only show them when the correct radio option is selected. The script should be similar to:

<script type="text/javascript">
 
function displayField()
{
document.getElementById('hide1').style.display="none";
document.getElementById('hide2').style.display="none";
 
if(document.getElementsByName('form[radio_group_name]')[0].checked)
{
document.getElementById('hide1').style.display="";
}
 
if(document.getElementsByName('form[radio_group_name]')[1].checked)
{
document.getElementById('hide2').style.display="";
}
</script>


In order to hide the fields when the page is loaded you should add the following script after your already existing code found in the "Form Layout" tab:

<script type="text/javascript">
displayField();
</script>
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team

Re:How to hide textbox not after checking chechbox 1 year, 5 months ago #11194

  • lucrece
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
Anyone gotten this to work?

Re:How to hide textbox not after checking chechbox 6 hours, 1 minute ago #0

Hello,
This is an automatically generated message.
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 wish to receive our 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: http://www.rsjoomla.com/support-policy.html.

Thank You!
PLEASE NOTE: This topic is NOT locked and you can add replies to it. Other users are free to reply as well. This message has been generated by a bot and has no effect on the topic whatsoever.
  • Page:
  • 1
Moderators: alex, alexp, octavian, bogdanc, andreic
Time to create page: 0.84 seconds
Feedback