Normal Topic Make a Form Readonly in Update Mode (Read 1241 times)
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Make a Form Readonly in Update Mode
Jan 4th, 2011 at 6:45pm
Print Post Print Post  
What's the easiest way to make a form readonly in update Mode? I have the following line in programming but somehow they are able to delete data in the element?

If @Group = "Users" and @Update then Readonly(Item Name,2) "not working at all"
If @Update then Readonly(Item Number,2)

I found the data gone and two dots in the field?
« Last Edit: Jan 4th, 2011 at 7:54pm by proudpoppy »  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Make a Form Readonly in Update Mode
Reply #1 - Jan 4th, 2011 at 7:14pm
Print Post Print Post  
Do you have other programming that make those elements writeable or that sets the value in those elements?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: Make a Form Readonly in Update Mode
Reply #2 - Jan 4th, 2011 at 7:40pm
Print Post Print Post  
Nope that's my inventory database and I only add new records occasionally, Others just need to view the records and make no changes, when they go into search mode sometimes they forget to hit F7 to get the blank screen, they just start typing in the current record, I thought the above would of stopped it, but somehow someone got around it?
  
Back to top
 
IP Logged
 
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: Make a Form Readonly in Update Mode
Reply #3 - Jan 4th, 2011 at 7:50pm
Print Post Print Post  
This morning when I got here the item name element had two dots in it, the item number was empty, all the other elements were populated, the item number field is readonly and grayed out, how they blanked it I don't know???  Huh  I have been trying for over a hour to duplicate what happened yesterday to no avail.
« Last Edit: Jan 4th, 2011 at 9:17pm by proudpoppy »  
Back to top
 
IP Logged
 
Hammer
YaBB Administrator
Lanticans
*****
Offline


Fire bad. Tree pretty.

Posts: 3436
Location: Ohio
Joined: Nov 22nd, 2002
Re: Make a Form Readonly in Update Mode
Reply #4 - Jan 5th, 2011 at 6:15pm
Print Post Print Post  
proudpoppy wrote on Jan 4th, 2011 at 7:50pm:
This morning when I got here the item name element had two dots in it, the item number was empty, all the other elements were populated, the item number field is readonly and grayed out, how they blanked it I don't know???  Huh  I have been trying for over a hour to duplicate what happened yesterday to no avail.

Might they be able to shed some light on how they did it?

Also, in which element/event is the ReadOnly programming?
  

- Hammer
The plural of anecdote is not data.
Back to top
IP Logged
 
lksseven
Full Member
***
Offline



Posts: 416
Location: Southwest
Joined: Jan 26th, 2009
Re: Make a Form Readonly in Update Mode
Reply #5 - Jan 31st, 2011 at 3:50pm
Print Post Print Post  
Poppy,

the following works for me in my inventory database (and keeps the users from accidentally stepping on an ItemNum with ".." search attempts while in 'update' mode).  It allows the ItemNum to be written to if in Add or Search mode, but not in Update mode:

ItemNum:ShockednElementEntry ...

If (@mode() = 1) AND (@IsBlank(ItemNum) = 0) and (FixOKd <> 1)
     {
           ReadOnly(ItemNum,2)
     }


I also have code to make ItemNum writable for modes ItemNum:ShockednFormReveal, OnFormChanges, OnFormEntry, and Inventory::Retrieve Spec Open with the following  code:

If @Mode() = 2
 {
     ReadOnly(ItemNum, 0)
 }


My users do not have access to the side panel, and must utilize on form command buttons (preferable) or function keys (old habits).  I try to have my users save a changed record by having to use a command button to save (instead of F10, which I disable temporarily with the following code), as I have other housekeeping that is checked/updated when a record is changed in Inventory.

Inventory:ShockednFormEntry

If (@Mode() = 0) and @IsNew
 {
     IgnoreKey(KEYCODE_F10, 0)
 }

If @Mode() = 1
 {
     IgnoreKey(KEYCODE_F10, 0)
       NotifyForm(7)
     
 }

If @Mode() = 2
 {
     ReadOnly(ItemNum, 0)
     ClearIgnoreKey(KEYCODE_F10)
 }

and on Inventory:ShockednFormExit and Inventory::RetrieveSpecOpen

ClearIgnoreKey(KEYCODE_F10)


Hope I'm not steering you wrong.  The above arrangement works for my users beautifully.

ps (I have a 'fix' command button that allows ItemNum to become writable in update mode in the event I need to change something in the ItemNum or ItemCategory designation).
« Last Edit: Jan 31st, 2011 at 6:51pm by lksseven »  

Larry
Back to top
IP Logged
 
proudpoppy
Full Member
Members
***
Offline


Do What ??

Posts: 420
Location: South Carolina
Joined: Apr 7th, 2004
Re: Make a Form Readonly in Update Mode
Reply #6 - Feb 2nd, 2011 at 5:03pm
Print Post Print Post  
Thanks, Lksseven they may be using the Sesame menu's instead of my command buttons, have too look into that.
  
Back to top
 
IP Logged
 
Acebanner
Full Member
***
Offline



Posts: 123
Location: New York City
Joined: Jan 23rd, 2008
Re: Make a Form Readonly in Update Mode
Reply #7 - Feb 3rd, 2011 at 1:07pm
Print Post Print Post  
I don't know if this will apply in this case, but I used the AppSaveMode() command for a purely historical database. The command prevented the addition of any new records and the deletion or alteration of any records. It works for me, but may be overkill in your situation. It's important to make sure it gets toggled back to normal after it's no longer needed, however.
  
Back to top
IP Logged