NetTalk Central

Author Topic: Copy Button  (Read 3335 times)

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Copy Button
« on: January 09, 2012, 01:21:39 PM »
I would like to intercept the copy button and check two fields before allowing the copy.  In the PreCopy embed I have the following:

  If UPPER(Spe:Path_Complete) = 'NO' OR Spe:Path_Complete = ''
      Case Message('Pathology not complete.|Please complete pathology before copying.', 'Warning', Icon:Exclamation, Button:OK, Button:OK, 1)
      Of Button:OK
           cycle
      End
  End

The compiler complains about the cycle statement, even though the help docs on Case Message show the use of cycle.  I have also tried break and return.  What is the proper way to stop the conditionally copy?

Thanks,

Jeff

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Copy Button
« Reply #1 on: January 09, 2012, 01:42:15 PM »
Hi Jeff,

a couple of problems...

You can't use Message in a web app as this pops up on the web server and not the browser. You need to use loc:alert and do sendalerts (look at the source code for field validation on a form)

You would need to use exit not cycle.

HTH

Kev

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Copy Button
« Reply #2 on: January 09, 2012, 11:30:50 PM »
Hi Jeff,

The Web browse and form interact quite differently to the Windows one, so the normal Clarion help isn't going to apply here.

There is a way to suppress the action, (by setting ans=0 in the Initform routine) but it's been a really long time since I looked at this and I'm not sure it's going to work completely smoothly in all cases. Also there wasn't an opportunity there to alert the user as to why the action wasn't allowed. I think I'll work on this a bit an report back - I suspect some tweaks will be required.

cheers
Bruce


jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: Copy Button
« Reply #3 on: January 10, 2012, 11:08:29 AM »
Thanks Bruce and Kevin,

Just to summarize, during a copy, I want to check a few fields to see if they have a certain value and notify the user, if they don't have the correct values.  I may also want to change/delete other field contents.

Thanks,

Jeff