CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Change the listbox to label in "update" mode

Print topic Send  topic

Author Message
rado

Posts: 221
Posted: 11/23/2008, 10:41 AM

I have record with few fields and one of them (primary_key) is "listbox". What I need is to change the "listbox" field to "label" but just in "update/delete" mode. When is insert mode I have to keep "listbox". Any short tip how can I do that?

Thanks, Rado
View profile  Send private message
rado

Posts: 221
Posted: 11/23/2008, 11:00 AM

Something like - if EditMode is True change "filed1" listbox property to "label". I assume I should use "beforeshow" event.

Thanks, Rado
View profile  Send private message
Gena

Posts: 591
Posted: 11/23/2008, 11:34 AM

You can't change it runtime. But you can create 2 different control = listbox and label, put 2 Pannel around it, then add a Before Show event for your Record form:

if ($Container->EditMode) {
//Edit Mode
$Container->Pannel_listbox->Visible = False;
} else {
//Add Mode
$Container->Pannel_label>Visible = False;
}
_________________
Gena
View profile  Send private message
rado

Posts: 221
Posted: 11/23/2008, 12:36 PM

Again you.:-).
Thank you so much Gena.
I'm going to try it.

Rado :-)
View profile  Send private message
rado

Posts: 221
Posted: 02/07/2009, 12:38 PM

After long time I tried this solution and it works fine. Thanks Gena. However I have problem with field that is required in "add" mode but not in "edit" mode. I can't perform update of record. I got message "The value in field Apartment Number is required". How can I change the properties of field in edit mode? I update my custom code and it looks like :
==========================================================
//Custom Code @140-2A29BDB7
// -------------------------
if ($Container->EditMode) {
//Edit Mode
$Container->Pannel_listbox->Visible = false;
$Container->unit_number->Required = false;
} else {
//Add Mode
$Container->Pannel_label->Visible = false;
}
// -------------------------
//End Custom Code
=============================================================
but it doesn't work.

Is there anybody that can help me?

Thanks a lot.

Rado
View profile  Send private message
damian

Posts: 838
Posted: 02/07/2009, 7:15 PM

havent done it myself - but according to help -
-----
Syntax
object->EditMode
Description
This property determines whether given record form is currently in edit or insert mode. In edit mode all data source parameters need to have values assigned (including row identifier). In insert mode not all have to be assigned values.
Examples
The following example shows how to hide a dependent form on a page when the main form is not in EditMode.

global $items;  
global $item_prices;  
  if (! $items->EditMode)  
  {  
     $item_prices->Visible = false;  
  }
where $items is the name of the main form, and $item_prices is the name of the form that shows elements that depend on the data in the main form.

------
syntax is a little different to what you have used....


_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
damian

Posts: 838
Posted: 02/07/2009, 7:18 PM

also - gena's example is hiding the panel - have you enclosed your field in a panel?
my example was hiding a whole grid/record
_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
rado

Posts: 221
Posted: 02/07/2009, 7:37 PM

Yes I have enclosed my fields in pannel, and I named the panel exact as Gena's example. The hiding the panels works just fine, however the update procedure doesn't since the one of the list-box required field is hidden. Now I'm looking for solution to change the property of list-box (not required) when the mode is edit.

Thanks for respond.

Rado
View profile  Send private message
damian

Posts: 838
Posted: 02/07/2009, 8:55 PM

ok - if the field is required, and you are editing an existing record, why isnt there a value already in this field?

anyways - create 2 edit grids - one for add which includes this field and one for edit which doesnt contain the field/record at all. update your links appropriately.
i *think* there may also be a way to *disable* a field - you may be able to use the method above to do such a thing

_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
damian

Posts: 838
Posted: 02/07/2009, 9:11 PM

-or-
create 2 editable grids in seperate panels and show/hide the panel based on the url parameter (or lack of for add mode)...
_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message
rado

Posts: 221
Posted: 02/08/2009, 7:13 PM

Thanks damian,

When i run my record in edit mode without hiding list-box and label, both fields have same the value. Then when I hide list-box and show just the label to disable user to change it, then I got problems when I hit update button about required field. It looks like that update works just with list-box and when is not hidden. The label is not even considered.

I will try this solution with two 2 editable grids.

Thanks again for help.

Rado
View profile  Send private message
Oper


Posts: 1195
Posted: 02/09/2009, 4:59 AM

Rado did you try avoiding the required attibutes(to no) and only validate (on validate events)
of course during insert mode.
_________________
____________________________
http://www.7bz.com (Free CMS,CRM Developed in CCS)

http://www.PremiumWebTemplate.com
Affiliation Web Site Templates

Please do backup first
View profile  Send private message
rado

Posts: 221
Posted: 02/09/2009, 9:45 AM

Actually, I didn't try it. It sounds much simpler solution then setting up two different edit grids ....

Thanks, I will definitely try it.

Rado
View profile  Send private message
rado

Posts: 221
Posted: 02/09/2009, 9:55 AM

Since I didn't work with "on validate events" before (still newbie with CCS), is there standard validation code that I can use for "required filed" validation or I have to write my own validation procedure? Is there any example that I can use for it?

Thanks, Rado
View profile  Send private message
rado

Posts: 221
Posted: 02/09/2009, 8:40 PM

I just tried to use "on validate" event and once I set it I got exact same problem - the update didn't go trough since the required field (this time controled by :validate on" event) was empty.

Rado
View profile  Send private message
damian

Posts: 838
Posted: 02/09/2009, 8:50 PM

if you are using the "on validate" event you would still need to somehow have it check whether you are in update or add mode... required is still required....
you might be able to change/set your validation string in before show....

it only take a couple of minutes to run the builder to create a new grid.... put both grids in panels... show hide your panels... really doesnt take long... maybe not so elegant... but it works.

_________________
if you found this post useful take the time to help someone else.... :)
View profile  Send private message

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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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