• 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: Write default value in hidden dropdown field

Write default value in hidden dropdown field 10 years 3 months ago #30010

For administrative reasons I have a dropdown field called "payed" with options 'no' and 'yes'. The field is not displayed in the form but is only used for displaying it in the frontend directory.

The form is used to subscribe users to an event. And when someone has payed for the event our secretary can change the value of the "payed" drop down field to 'yes'. Now, this field is Always blank by default when the form is submitted but I want it to be 'no' as default.

How can I acieve this?
The administrator has disabled public write access.

Write default value in hidden dropdown field 10 years 3 months ago #30022

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
Have you tried using this solution?

"
You can even have an option selected by default, by using the [c] syntax. For example:
Steve Matt|Steve Matt, marketing director[c]
"

More information can be found here:
https://www.rsjoomla.com/support/documentation/view-article/827-dropdown.html
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.

Write default value in hidden dropdown field 10 years 3 months ago #30039

Ah, forgot to mention that...

Yes, ofcourse i've tried that as one of the first things but unfortunately, that didn't do the trick... :(
The administrator has disabled public write access.

Write default value in hidden dropdown field 10 years 3 months ago #30042

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
I don't know exactly how you hid it, however I just tested this functionality and it's working.

Steps taken:

Created dropdown and used [c] on the item I needed to be selected by default.

I went to CSS and Javascript section and I hid it like this:
jQuery(document).ready(function(){
  jQuery('.class_of_the_rsform_field_wrapper').hide();
});

Although the dropdown field was not visible, the "pre-selected" element was saved in the database.
My help is not official customer support. To receive your support, submit a ticket by clicking here
The administrator has disabled public write access.

Write default value in hidden dropdown field 10 years 3 months ago #30053

Hmmz,

Somehow I don't get this working... The dropdown field does not get hidden. Maybe i missed something.
The way I've hidden the 'payed' dropdown box is by just removing the table row from the table lay-out code and dont let it auto generate the form.

This is what i have now:

-A dropdown named 'betaald' (which is dutch for payed) with the values 'Nee' and 'Ja' (No and Yes) ;-)
-Put back the table row in the form lay-out as follows:
<tr class="rsform-block rsform-block-betaald">
		<td colspan="2">{betaald:caption}*</td>
		<td>{betaald:body}<div class="formClr"></div>{betaald:validation}</td>
		<td>{betaald:description}</td>
	</tr>
-added the code you posted to CSS at CSS and Javascript section. Also tried to add it to Javascript code and as follows:
<script type="text/javascript">
jQuery(document).ready(function(){
  jQuery('.rsform-block rsform-block-betaald').hide();
});
</script>

Unfortunatelyall without result. As you can see here: Link to form the 'betaald' dropdown is still displayed...

I think i'm making a little mistake which I do not see...
The administrator has disabled public write access.

Write default value in hidden dropdown field 10 years 3 months ago #30054

I found it!

Somehow there needs to be a dot instead of a space in the class name. So now it looks like this:
jQuery(document).ready(function(){
  jQuery('.rsform-block.rsform-block-betaald').hide();
});

And now it works! The new submissions has "No" as a default filled in value now!!

Thanks a million!
Last Edit: 10 years 3 months ago by svenleeman.
The administrator has disabled public write access.

Write default value in hidden dropdown field 10 years 3 months ago #30063

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
The issue was (in your first method) that RSForm!Pro didn't even generate the dropdown field. However, as for your 2nd question, correct selector for an element with multiple classes is like this : '.class.class.class' however, for your case it would have sufficed to use only this: '.rsform-block-betaald'.
My help is not official customer support. To receive your support, submit a ticket by clicking here
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!