rbaldwin
|
| Posted: 06/28/2002, 10:57 AM |
|
I want to display a Lable for an Edit screen but a textbox for an update screen any suggestions.
|
|
|
 |
Chris K.
|
| Posted: 06/28/2002, 11:17 AM |
|
You could either create two records for edit case and for update case and hide them according to EditMode property value.
Another solution could be to place both label and textbox, enclose them in HTML view within <!-- BEGIN blockname --> ... <!-- END blockname --> comments and show one of them according to record mode using its Show method and parsing its blockname template.
BeforeShow event could look like:
global $form;
global $Tpl;
if (control_is_to_be_shown)
{
$form->control_to_show->Show();
$Tpl->parse("block_surrounding_control_to_show");
}
|
|
|
 |
rbaldwin
|
| Posted: 06/28/2002, 1:09 PM |
|
Thanks Chris. I'm doing asp. The error i get is
Wrong number of arguments or invalid property assignment: 'Tpl.Parse'
/NewProject1/f_04AddlBa_maint_events.asp, line 38
I've got the following where f_04AddlBankInf is my form and Country is my lable and CountryList is my list box.
My HTML looks like this:
<td class="InLineDataTD">
<!-- BEGIN CountryLabel -->
{Country}
<!-- END CountryLabel -->
<!-- BEGIN CountryList -->
<select name="CountryList">
<option value="" selected>Select Value</option>
{CountryList_Options}
</select>
<!-- END CountryList -->
</td>
========== my Before show==================
29. Dim showCountry
30. if f_04AddlBankInf.EditMode then
31. showCountry = 0
32. else
33. showCountry = 1
34. end if
35.
36. 'dim Tpl
37. if (showCountry) then
38. Tpl.parse "block_surrounding_CountryLabel", 0
39. f_04AddlBankInf.Country.Show Tpl
40.
41. else
42. Tpl.parse "block_surrounding_CountryList", 0
43. f_04AddlBankInf.CountryList.Show Tpl
44.
45. End if
|
|
|
 |
Chris K.
|
| Posted: 06/28/2002, 2:26 PM |
|
Your template is OK. Event should look like:
Dim showCountry
if f_04AddlBankInf.EditMode then
showCountry = 0
else
showCountry = 1
end if
'dim Tpl
if (showCountry) then
f_04AddlBankInf.Country.Show Tpl
Tpl.Parse "CountryLabel", false
else
f_04AddlBankInf.CountryList.Show Tpl
Tpl.Parse "CountryList", false
End if
Beware that controls must be shown before parsing!
I hope this will work
|
|
|
 |
rbaldwin
|
| Posted: 07/02/2002, 8:13 AM |
|
Thanks again Chris K., should have gotten back sooner but I'm in Canada and our long weekend was the one just passed.
But, i'm still having a problem. B.T.W. Where do I find a working example of .Show and .Parse ??
Wrong number of arguments or invalid property assignment: 'Tpl.Parse'
/NewProject1/f_04AddlBa_maint_events.asp, line 41
my beforeShow
Function f_04AddlBankInf_BeforeShow() 'f_04AddlBankInf_BeforeShow @2-C91A7A72
'Custom Code @26-73254650
' -------------------------
Dim showCountry
if f_04AddlBankInf.EditMode then
showCountry = 0
else
showCountry = 1
end if
'dim Tpl
if (showCountry) then
f_04AddlBankInf.Country.Show Tpl
Tpl.Parse "CountryLabel", false ' here is line 41
else
f_04AddlBankInf.CountryList.Show Tpl
Tpl.Parse "CountryList", false
End if
f_04AddlBankInf.Country.Value = CCDLookUp("Country", "00Country_BankData", "ID=" & CCToSQL(f_04AddlBankInf.Country.Value,"Integer"), DBConnection1)
f_04AddlBankInf.modifyUser.Value = CCDLookUp("Login", "Users", "ID=" & _
CCToSQL(f_04AddlBankInf.modifyUser.Value,"Integer"), DBConnection1)
' -------------------------
'End Custom Code
End Function 'Close f_04AddlBankInf_BeforeShow @2-54C34B28
|
|
|
 |
|