NetTalk Central

Author Topic: EIP Select new field based on value after EIP accepted  (Read 3195 times)

pkonyk

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
EIP Select new field based on value after EIP accepted
« 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

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: EIP Select new field based on value after EIP accepted
« Reply #1 on: August 11, 2016, 12:13:41 AM »
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

pkonyk

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: EIP Select new field based on value after EIP accepted
« Reply #2 on: September 06, 2016, 01:58:26 PM »
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
« Last Edit: September 06, 2016, 02:20:59 PM by pkonyk »