Change Drop box on Plain text

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
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
skuter 09 Apr, 2015
Hi Bob,
perfecto, it works!
Thanks.
This topic is locked and no more replies can be posted.