Hi,
I have created a form for membership information. I have used the DB Record loader and am populating the information from a database. One of the fields specifies the membership level (family or senior).
I have a section of the form for "children" of the members, but the Senior membership does not include children, so I would like to hide this section
I have found examples of how to show/hide with a radio button, but I would like to know if it is possible to show/hide the div based on the value of a field that is being loaded with the DB Record Loader. My Senior members have a member number in the 500's and family members have a member number <500.
Is it possible to show/hide a particular div based on the loaded value of the member number?
Thank you,
Apryl
I have created a form for membership information. I have used the DB Record loader and am populating the information from a database. One of the fields specifies the membership level (family or senior).
I have a section of the form for "children" of the members, but the Senior membership does not include children, so I would like to hide this section
<div class="formitem" id="children" style="display: none">
I have found examples of how to show/hide with a radio button, but I would like to know if it is possible to show/hide the div based on the value of a field that is being loaded with the DB Record Loader. My Senior members have a member number in the 500's and family members have a member number <500.
Is it possible to show/hide a particular div based on the loaded value of the member number?
Thank you,
Apryl
Hi Apryl,
It's easy to do with Custom Form HTML - just add the necessary PHP to display the bloks of code you need. There isn't any way to do it in the Drag and Drop Preview window in the Wizard.
You can build a 'hybrid' form by using the Wizard to build the Form HTML, then switching to Custom HTML and adding the PHP you need.
Bob
It's easy to do with Custom Form HTML - just add the necessary PHP to display the bloks of code you need. There isn't any way to do it in the Drag and Drop Preview window in the Wizard.
You can build a 'hybrid' form by using the Wizard to build the Form HTML, then switching to Custom HTML and adding the PHP you need.
Bob
Hi Bob,
I can't seem to get this to work. I want to use some code like:
but for some reason it does not seem to pick up the field data 'memno'
I am not sure if I am doing this right, and another option I tried was within the div tag:
but that didn't work either and just returned an error.
Any help is greatly appreciated.
Thank you,
apryl
I can't seem to get this to work. I want to use some code like:
<?php if ('memno'() <= 500) { ?>
<div class="formitem" id="childreny" style="display: none"></div>;
<?php } else { ?>
<div class="formitem" id="childreny" style="display: block"></div>;
<?php } ?>
but for some reason it does not seem to pick up the field data 'memno'
I am not sure if I am doing this right, and another option I tried was within the div tag:
<div style='<?php if ("memno"() <= 500) { echo "display:none;"; } ?>'>form stuff here</div>
but that didn't work either and just returned an error.
Any help is greatly appreciated.
Thank you,
apryl
Hi Apryl,
I don't know what 'memno'() is meant to be - it's not valid PHP as far as I know.
Please try
Bob
I don't know what 'memno'() is meant to be - it's not valid PHP as far as I know.
Please try
<?php
if ( $form->data['memno'] <= 500 ) {
$display = 'none';
} else {
$display = 'block';
}
?>
<div class="formitem" id="childreny" style="display: <?php echo $display; ?>"></div>
Bob
Hi Bob,
Thanks for your help. 'memno' is the name "member number" field on the form that is being loaded from the db record loader.
I tried the code you posted, but got a "data_republish.php(24)" error. I put a ";" after $display = 'none', and that seemed to fix the error, but it still does not seem to recognize 'memno' or member number from the loaded data.
Any ideas?
Thanks,
apryl
Thanks for your help. 'memno' is the name "member number" field on the form that is being loaded from the db record loader.
I tried the code you posted, but got a "data_republish.php(24)" error. I put a ";" after $display = 'none', and that seemed to fix the error, but it still does not seem to recognize 'memno' or member number from the loaded data.
Any ideas?
Thanks,
apryl
This topic is locked and no more replies can be posted.