CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 hiding listbox control messes up update

Print topic Send  topic

Author Message
Don Safar
Posted: 01/12/2004, 7:56 PM

This is a multi-part message in MIME format.

------=_NextPart_000_0153_01C3D946.1CD93180
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I have a record form that I wish to hide two listbox controls depending =
on security level. This was implemented as below in the form before show =
event

If CCGetGroupID() < 2 Then
issue.List_assign.Visible =3D False
End if

If CCGetGroupID() < 2 and NOT issue.EditMode Then
issue.List_status.Visible =3D False
End if

This works ok. They are both not visible in insert mode. In EditMode the =
status listbox is visible. When I click the submit button I get an error =
- "The value in field Assign is required." The assign field is required. =
Does hiding the control on the record form prevent the recordset value =
from passing through to form update? Has anyone else come across this? I =
am hoping for a solution that does not require me to have 4 different =
forms on the page (hiding 3 and showing the 1 that meets the correct =
conditon). Any ideas on this?
------=_NextPart_000_0153_01C3D946.1CD93180
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>I have a record form that I wish to =
hide two=20
listbox controls depending on security level. This was implemented as =
below in=20
the form before show event</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>  If CCGetGroupID() < =
2 =20
Then<BR>   issue.List_assign.Visible =3D =
False<BR>  End=20
if</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>  If CCGetGroupID() < =
2  and NOT=20
issue.EditMode Then<BR>   issue.List_status.Visible =3D=20
False<BR>  End if</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>This works ok. They are both not =
visible in insert=20
mode. In EditMode the status listbox is visible. When I click the submit =
button=20
I get an error - <FONT face=3D"Times New Roman" =
size=3D3>"</FONT></FONT>The value in=20
field Assign is required." The assign field is required. Does hiding the =
control=20
on the record form prevent the recordset value from passing =
through to form=20
update? Has anyone else come across this? I am hoping for a solution =
that does=20
not require me to have 4 different forms on the page (hiding 3 and =
showing the 1=20
that meets the correct conditon). Any ideas on this?</DIV></BODY></HTML>

------=_NextPart_000_0153_01C3D946.1CD93180--
peterr


Posts: 5971
Posted: 01/12/2004, 10:36 PM

I'll check with our team if the handlingof such case can be improved, while for now you can use the following workaround:
Utilize the reverse logic - by default do not make the field required, but utilize custom validation when the field is shown and should be required.
For example:
Do not make changes in your code in Before Show, but make the field NOT required. Then add this sample custom code to the form's "On Validate" event:
  
If CCGetGroupID() >= 2 or issue.EditMode Then  
if issue.List_status.Value = "" then issue.Errors.addError("The status Listbox value is required")  
End if  
The above example may need to be expanded and adapted to your specific situation.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
peterr


Posts: 5971
Posted: 01/14/2004, 3:12 AM

Additional information: I haven't tried it yet, but I was told that you can also modify the "Required" property of the ListBox in the "After Initialize" event of the page. For example:
issue.List_status.Required = False
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
jayme
Posted: 03/17/2004, 2:50 AM

If recordformname.EditMode Then
recordformname.listbox2.Visible = False
End if

This code hides a Listbox (with extended HTML). However, when Updating the recordform, I get a validation error referencing the listbox as a required field (i.e. it thinks it is empty). Why?

I need to be able to hide the Listbox in the same manner as we hide textboxes. Is there a workaround? Thank you.
DonB
Posted: 03/17/2004, 4:44 AM

Since you are not updating the Listbox (it's hidden so the value can't be
changed, right?), you could specify a Custom Update property that excludes
the hidden control(s) from the list of columns affected by the update.

--
DonB

http://www.gotodon.com/ccbth


"jayme" <jayme@forum.codecharge> wrote in message
news:640582d8b69d00@news.codecharge.com...
> If recordformname.EditMode Then
> recordformname.listbox2.Visible = False
> End if
>
> This code hides a Listbox (with extended HTML). However, when Updating
the recordform, I get a validation error referencing the listbox as a
required field (i.e. it thinks it is empty). Why?
>
> I need to be able to hide the Listbox in the same manner as we hide
textboxes. Is there a workaround? Thank you.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.