Hi Bruce,
you need an exampe as application or a detailed description?
Here is the description. In the attachment you find a picture of the form. Its a form based on memory.
Pressing 'Speichern' the form calls itself again, passing an action parameter which does the action defined in the GenerateForm embed, actions can be 'Save' and 'Empty', 'Save' puts the last entries into the database, 'Empty' clears the form. In this way the form cycles until the user aborts or selects the main menu.
The process is the following. The user opens the form which then is empty. Then he types the number of a spare part or scans a barcode with a scanner as keyboard wedge.
If he accepts the EANCode field then in the source code in the embed ValidateValue loads data from the data base (description and first stock location). The fields 'ErsBezeichnung', 'Menge' and 'Lagerort' are in the reset list of 'EANCode'.
As remarked the focus field is set to 'Menge' (amount).
But the focus is not set to 'Menge', it is somewhere, after pressing 'Tab' it is in 'Menge'.
The code I use:
Validate::EANCode Routine
data
! Start of "After Validate New Value"
! [Priority 5000]
! End of "After Validate New Value"
code
! Start of "After Validate New Value"
! [Priority 5000]
! End of "After Validate New Value"
! Start of "Validate New Value"
! [Priority 5000]
! End of "Validate New Value"
! Start of "Validate New Value"
! [Priority 5000]
! End of "Validate New Value"
If p_web.Ajax = 1 and p_web.ifExistsValue('NewValue')
EANCode = p_web.GetValue('NewValue')
ElsIf p_web.IfExistsValue('Value') !FormFieldPicture = '@s20' !FieldPicture =
EANCode = p_web.Dformat(p_web.GetValue('Value'),'@s20')
End
do ValidateValue::EANCode ! copies value to session value if valid.
If loc:noFocus = false
p_web.SetValue('SelectField',clip(loc:formname) & '.' & p_web.NoColon(Menge))
End
! Start of "After Validate New Value"
! [Priority 4000]
! End of "After Validate New Value"
p_web.PushEvent('parentupdated')
do Refresh::EANCode ! Field is auto-validated
do SendMessage
do Refresh::ErsBezeichnung !(GenerateFieldReset)
do Refresh::Lagerort !(GenerateFieldReset)
do Refresh::Menge !(GenerateFieldReset)
p_web.ntForm(loc:formname,'ready') ! 8.67 (in case the form was not the originator of the Ajax call)
! Start of "After Validate New Value, After sending replies"
! [Priority 5000]
! End of "After Validate New Value, After sending replies"
p_web.PopEvent()
ValidatValue::EANCode ROUTINE
! End of "Validate Value"
If loc:invalid = '' then p_web.SetSessionValue('EANCode',EANCode). !NetTalk
! Start of "Validate Value"
! [Priority 5000]
IF LEN(CLIP(EANCode)) THEN
p_web.OpenFile(Ersatzteile)
p_web.OpenFile(ErsatzLager)
EANCode = LEFT(CLIP(EANCode))
ERS:EANCode = SUB(EANCode,1,12)
GET(Ersatzteile,ERS:KeyEANCode)
IF ERRORCODE() THEN CLEAR(ERS:Record).
ErsBezeichnung = CLIP(ERS:Nummer) & ' ' & ERS:Bezeichnung
ErsSysPk = ERS:SysPk
Menge = 1
Lagerort = ''
ERL:ErsSysPk = ErsSysPk !get the first stock location
SET(ERL:KeyErsSysPk,ERL:KeyErsSysPk)
NEXT(Ersatzlager)
IF ~ERRORCODE() THEN
Lagerort = ERL:Lagerort
END
p_web.SSV('ErsSysPk',ErsSysPk)
p_web.SSV('Lagerort',Lagerort)
p_web.SSV('ErsBezeichnung',ErsBezeichnung)
p_web.SSV('Menge',Menge)
p_web.CloseFile(Ersatzteile)
p_web.CloseFile(ErsatzLager)
p_web.SetValue('SelectField',clip(loc:formname) & '.' & p_web.NoColon(Menge)) !NetTalk
END
Some times I can see, that accepting 'EANCode' the cursor jumps to 'Menge', but then refreshing or reseting the other fields appears afterwards and after that the focus is no longer in an input field.
I hope this explans the facts.
If its not enough please tell me what to send you.
Thanks a lot
Cheers
Heinz