Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Req fields - Wizard 1

Status
Not open for further replies.

Dalarna

Programmer
Mar 8, 2010
22
0
0
SE
Hi!
I have a Form with multiple Tabs some of which are required with required fields on them I have set the Sheet to Wizard so the User has to progress one tab at a time and I need to validate the required fields on the way through The problem is that I can move through the tabs using Back and Next buttons but it doesnt check the required controls until the Finish (OK) button is pressed
If I remove the Wizard property and click on the tabs it works perfectly Any ideas as to the best way to solve this “problem”?
Any help would be Great

From the snow in Sweden
/Magne
 
Hi!

You can use the EVENT:TabChanging of the SHEET to validate a tab when it changes ::

Assuming that ?CurrentTab is the FEQ of the Sheet Control and ?Tab:1, ?Tab:2 are the FEQs of the Tabs, in the Embeds - Control Events - ?CurrentTab - EVENT:TabChanging - after/before parent call ::

Code:
CASE ?CurrentTab{PROP:ChoiceFEQ}
OF ?Tab:1
  <Tab 1 control validation>
OF ?Tab:2
  <Tab 2 control validation>
...
END

[red]OR[/red]

CASE CHOICE(?CurrentTab)
OF 1  !?Tab:1
  <Tab 1 control validation>
OF 2  !?Tab:2
  <Tab 2 control validation>
...
END

To do a generic REQ checking, you can scan all the controls and their parents using PROP:NextField & PROP:parent.

Code:
UPDATE

Parent#  = ?CurrentTab{PROP:ChoiceFEQ}
Control# = Parent#
LOOP
   Control# = Window{PROP:NextField, Control#}

   IF NOT Control# THEN BREAK.

   IF Control#{PROP:Parent} <> Parent# 
      Control# = 0 ; BREAK
   END

   CASE Control#{PROP:Type}
   OF CREATE:Entry
     IF Control#{PROP:Req} = True AND CONTENTS(Control#) = ''
        BREAK
     END
   END
END
IF Control#  ! indicates a break in loop b'cos of empty
   BEEP
   MESSAGE('Must complete all required fields before going to nect page') 
   SELECT(Control#)
   CYCLE
END

Regards
 
Hi ShankarJ!
Thanks for your help!!
I shall try, but is a bit unsure if I can fix it self :-( :)
Can I contact you if I neeed help to fix the problem ?
/Magne
 
Hi!

Just do the below ::

Assuming that ?CurrentTab is the FEQ of the Sheet Control in the Embeds - Control Events - ?CurrentTab - EVENT:TabChanging - before parent call ::

Code:
UPDATE

Parent#  = ?CurrentTab{PROP:ChoiceFEQ}
Control# = Parent#
LOOP
   Control# = Window{PROP:NextField, Control#}

   IF NOT Control# THEN BREAK.

   IF Control#{PROP:Parent} <> Parent#
      Control# = 0 ; BREAK
   END

   CASE Control#{PROP:Type}
   OF CREATE:Entry ! checking for ENTRY controls only
     IF Control#{PROP:Req} = True AND CONTENTS(Control#) = ''
        BREAK
     END
   END
END
IF Control#  ! indicates a break in loop b'cos of empty
   BEEP
   MESSAGE('Must complete all required fields before going to next page')
   SELECT(Control#)
   CYCLE
END

Regards
 
Hi ShankarJ !
In the embeded, I don´t find the point for: Control Events - ?CurrentTab - EVENT:TabChanging - after/before parent call
:) :-(
/Magne

 
Hi,

As I said in my previous post "Assuming that ?CurrentTab is the FEQ of the Sheet Control ..." - maybe the name of your SHEET control is different. Use the Windows Designer or the ... button next to the "Window" button and find out the name of the SHEET control - could be ?Sheet1 or something else. All TAB Controls are children of a SHEET Control.

Regards
 
Hi ShankarJ

The embeded points I have:

Control events

Sheet1

- Accepted
- New Selection
- Selected
- TabChanging
- All events

In the choises
Generate Code
Perform fiels level validation

/Magne

 
Hi!

Code:
Sheet1

- Accepted                             } all     
- New Selection                        } these
- Selected                             } are
- TabChanging    <---- this one        } EVENTs
- All events                           }

Regards
 
Hi!

And ... insert the embed BEFORE "Generate Code".

Regards
 
Hi ShankarJ
This was not easy :) :)
I have insert your code in the embeds like this:

TabChanging
- Source (Your code)
- Generated Code
- Perform field level validation

But it will not work ...
"Assuming that ?CurrentTab is the FEQ of the Sheet Control ..."
Do I something wrong with "FEQ"?
(I do not know anything about FEQ :):-( :)
/Magne

 
Hi!

Did you change the ?CurrentTab in my code to ?Sheet1?

Each control on a window is assigned a number and that is the FEQ (Field Equate). ?Sheet1 is a FEQ label (Field equate label) and it normally is a number i.e. if you do a MESSAGE(?Sheet1) in your program it will display a number.

Read more on FEQ's in the help.

Regards
 
Hi ShankarJ!
Can you contact me?
You find my e-mail address on
esystem.se
/Magne
 
Hi!
The code don´t work,
Pressing the Next button doesnt check the required fields
I can go to the next side/sides without fill in reg fields
/Magne
 
Hi!

Contact me at

j s h a n k a r AT e i m DOT a e

with your code (CLW) of that procedure.

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top