• 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: Show/hide a field based on true/false validation ?

Show/hide a field based on true/false validation ? 6 years 6 months ago #37435

  • Paladin
  • Paladin's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
Hello to RSForm Pro Community and Support !

We all know RSFormPro has the Conditional Fields feature.
But there are no a condition there what allows to show or hide a field basing on Validation rule for another field.

AT-FIRST, as example, let's assume we set a custom valudation rule in
components/com_rsform/helpers/customvalidation.php
as explained in www.rsjoomla.com/support/documentation/r...alidation-rules.html
  public static function validationTest($value, $extra = null, $data = null)
  {
    // The following makes sure the submitted value is "test"
    if ($value == 'test')
    {
      // Return true if the validation passed.
      return true;
    }
    else
    {
      // Return false if the validation didn't pass.
      return false;
    }
  }
NEXT - we create a usual textfield with name 'texttest1' and set validation 'required' for the custom function 'validationTest' as above.
NEXT - we create a free text with name "freetest2" - without any validation, but hidden by default.

The question - is it possible (using a Javascript or PHP code in Form Properties) to show 'freetest2' for frontend user - only IF validation is FALSE ?
Saying simple - if you enter something wrong in 'texttest1' field - it says about an invalid input as always - but ALSO RSForm opens 'freetest2' field.


Actually this is very similar to Conditional Fields feature, but as said before - current Conditional Fields feature does not allow show/hide RSForm fields basing on true/false result of a validation rule for another field.

So that, thanks in advance for any code examples to try !
Best regards,
Serge
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!