Change Drop box on Plain text

Change a dropdown to plain text when an option is unavailable.

Overview

The issue occurs when a popular accommodation type in a dropdown becomes fully booked, requiring the form to display a static message instead.
Check accommodation availability using a DB Read or Custom Code action on form load, then use PHP in a custom container's Start box to conditionally hide the dropdown and show a plain text message.

Answered
sk skuter 08 Apr, 2015
On the form I have 2 types of accommodation as Dropbox
Accommodation 1 is more popular and it is expected that it will be quickly exhausted remains only
After the exhaustion of a certain number of accommodation 1, I want to cancel dropbox and paste only plain text "We have accommodation type 2"
Please do this?
Thanks
Gr GreyHead 09 Apr, 2015
Answer
Hi skuter,

First you will need to add a DB Read or Custom Code action to the form On Load event to check the availability. Once you have that as for example $form->data['count_acc1'] you can use the result to hide/show elements in the form Setup tab. The simplest way is probably to add a container of type custom around the element and to use PHP in the Start box to either show a message or show the drop-down.
<?php
if ( $form->data['count_acc1'] >= 20 ) {
  echo "<div>Sorry we only have accommodation type 2</div>
   <div style='display: none' >";
} else {
  echo '<div>';
}
?>
And then put the closing </div> in the end code box.

Bob
sk skuter 09 Apr, 2015
Hi Bob,
perfecto, it works!
Thanks.
This topic is locked and no more replies can be posted.