CodeChargenewbie
Posts: 114
|
| Posted: 11/27/2007, 7:10 AM |
|
I looked at the manual and did a brief search on this forum, but i don't understand what is the point of dynamic? What does it mean when it extends the code to the html??? How is it any different from creating custom code that hides or shows a control based on a conditional statement, for example? I really don't understand why or even how "dynamic" works. I set one of my fields, which contained no data, to dynamically visible and it still remained. I thought it was a matter of detecting if a field is NULL or contains data but I really have no clue. Maybe someone can show me some test code that I can play around with, so that I can see for myself the control hiding and reappearing on my own page and how it exactly works an when to use it.
Thank you very much!
|
 |
 |
chriscripps
Posts: 30
|
| Posted: 12/05/2007, 2:02 PM |
|
"Dynamic" allows the control to respond to your code. If you set the property to "no" then it will not display no matter what the code says. Same thing with "yes." If it is set to yes, no matter what the code, it will show up. there may not be a value in it, but it will show for example an empty text box or check box. Some code I have for a voting section of a project:
global $DBFor1;
global $vote;
$Page = CCGetParentPage($sender);
$ccs_result5 = $vote->choice5->GetValue();
$ccs_result5 = strval($ccs_result5);
$ccs_result3 = $vote->choice3->GetValue();
$ccs_result3 = strval($ccs_result3);
$ccs_result4 = $vote->choice4->GetValue();
$ccs_result4 = strval($ccs_result4);
if ($ccs_result3==""){
$vote_results->vote_results_ch3->Visible=false;
$vote_results->vote_results_ch4->Visible=false;
$vote_results->vote_results_ch5->Visible=false;
}else{
if ($ccs_result4==""){
$vote_results->vote_results_ch4->Visible=false;
$vote_results->vote_results_ch5->Visible=false;
}else {
if ($ccs_result5==""){
$vote_results->vote_results_ch5->Visible=false;
}}}
The site allows someone to call a vote and enter 5 foils (choices). If they only enter 2 choices, this code is in the before show event of the record builder where another user can enter their vote. It looks to see if the foil has words to it. If it does not, it sets the checkboxes for 3rd, 4th or 5th checkbox so they are not displayed. I had problems with these, as they always showed up. When I changed from Yes to Dynamic on the visible property of the check boxes, it worked fine and the checkboxes were not displayed. Until that change, they always displayed because yes was chosen as the visible property.
Hope that helps,
Chris
|
 |
 |
|