NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: pkonyk on August 08, 2016, 08:37:32 AM
-
I have a browse that has EIP turned on for several fields. I would like to select a specific EIP field based on the entry I make in an EIP field.
Example:
Browse
_____________________________
| Col 1 | Col 2 | Col 3 | Col 4 | Col 5 |
_____________________________
After entering a value in "Col 2" based on that value (in "Col 2") I need to either go to "Col 3" (normal behaviour) or to "Col 4" (what I am asking about).
I can trap the "eipaccepted" event but am not sure how to select the desired EIP field. Have tried:
p_web.SetValue('SelectField',clip(loc:formname)& '.' & p_web.NoColon('pre:col4'))
p_web.SetValue('_eipclm_', 'pre:col4')
do CallEip
This brings up an alert I've set for the field "Col 4" but doesn't stay on field "Col 4".
Thanks,
Paul
-
so, to be clear, it's a question of focus? ie after editing this column 2 the focus should then be on _either_ column 3 or 4?
cheers
Bruce
-
Bruce provided an answer in a NetTalk webinar.
Assume that the table being browsed is:
MyFileID LONG ! Primary key
Col_1 STRING(20)
Col_2 STRING(20)
Col_3 STRING(20)
Col_4 STRING(20)
Col_5 STRING(20)
And the browse for this table is BrowseMyFile
The javascript to select a different field is:
p_web.script('$("#' & 'inp'& field to select & '").focus();')
field to select looks like this:
p_web.crc32('BrowseMyFile_pre:Col_4'&pre:MyFileID)
Where:
BrowseMyFile is the name of the browse
_pre:Col_4 is the name of the field to select (with a leading underscore)
pre:MyFileID is the unique ID (primary key)
The complete javascript is:
p_web.script('$("#' & 'inp'& p_web.crc32('BrowseMyFile_pre:Col_4'&pre:MyFileID) & '").focus();')
or without formatting:
p_web.script('$("#' & 'inp'&p_web.crc32('BrowseMyFile_pre:Col_4'&pre:MyFileID & '").focus();')
Put this code in
Validate::pre:Col_2
! Start of "After Validate New Value"
! [Priority 5000]
IF p_web.GSV('pre:Col_2') = 'NEED COL 4'
p_web.script('$("#' & 'inp'&p_web.crc32('BrowseMyFile_pre:Col_4'&pre:MyFileID & '").focus();') ! Select pre:Col_4
ELSE
p_web.script('$("#' & 'inp'&p_web.crc32('BrowseMyFile_pre:Col_5'&pre:MyFileID & '").focus();') ! Select pre:Col_5
END
NOTE: Spelling and case are important, follow what is in the dictionary.
Cheers,
Paul