NetTalk Central

Author Topic: Dynamically changing EIP for a field - string, drop or none.....  (Read 3113 times)

rjolda

  • Sr. Member
  • ****
  • Posts: 329
    • View Profile
    • Email
Hi,
Using C7.1 and NT5.  I have a browse with a field that sometimes can take a value depending on how the data row is set up.  The field is a string.  Sometimes it can take a String ENTRY and sometimes it can be populated from a pre-defined set of DROP values.   The rest of the time, it cannot be edited.......

Trying to dynamically set my browse for EIP of no EIP and for the r_val field to be Editiable or Non Editable. If Editable, it will be a String ENTRY or DROP Queue.

I have taken the code for the string Entry and Drop Entry and no entry and made my own routine to display the  AIT1:r_val field in the Browse line.  It displays the FIRST set of data Fine.  The problem is that when I click NEXT, LAST it HANGS.   So, something is not right.   Can anyone shed any light on it?

Thanks,
Ron Jolda
_____________________________________________________________________________________

Here it the code:
Template field:    AIT1:r_val
Field:
Use Equate:
Type:String
Display:  ''
Picture: '@s1'
Allow Edit in Place: checked on
EIP condition:  loc:eiptype > 0
Refresh browse row DATA after server Code runs: checked on  ( no server code )



value::AIT1:r_val   Routine
  data
loc:extra      String(256)
loc:disabled   String(20)
loc:FormOk     Long(1)
loc:options    String(OptionsStringLen)  ! options for jQuery calls
loc:fieldClass String(255)
loc:javascript String(JavascriptStringLen)
  code
  !! !loc:eiptype = 0,1,2
  if upper( AIT1:r_contype) = 'ENTRY'!
    loc:eiptype = 1   
  elsif upper(AIT1:r_contype) = 'DROP LIST'
     loc:eiptype = 2
  else
     loc:eiptype = 0
       
  end   
  ! End of "Before a Cell value is calculated"
      if false
      else
        packet = clip(packet) & p_web._DivHeader('AIT1:r_val_'&AIT1:IH_ID,,net:crc)
        If loc:eiptype > 0
            loc:fieldclass = ''
            ! Start of "Generating Browse Field"
            ! [Priority 5000]
                     if loc:eiptype = 1  !string
                         loc:javascript = 'onchange="B_AimTMP2.eip(this,'''&p_web._jsok('AIT1:r_val')&''','''&p_web._jsok(loc:viewstate)&''');"'
                           packet = clip(packet) & p_web.CreateInput('text','inp'&p_web.crc32('AIT1:r_val'&AIT1:IH_ID),AIT1:r_val,p_web.combine(p_web.site.style.browseentry,,loc:fieldclass),0,,'@s49',loc:javascript,,,,) & '<13,10>'
           
                     elsif loc:eiptype = 2  !drop
                         ! --- DROPLIST ---
                      loc:javascript = 'onchange="B_AimTMP2.eip(this,'''&p_web._jsok('AIT1:r_val')&''','''&p_web._jsok(loc:viewstate)&''');"'
                         packet = clip(packet) & p_web.CreateSelect('AIT1:r_val'&AIT1:IH_ID,p_web.combine(p_web.site.style.browseDrop,,loc:fieldclass),,,,,loc:javascript,)
                      packet = clip(packet) & p_web.CreateOption('Clear',0,choose(0 = AIT1:r_val),p_web.combine(p_web.site.style.browseDropOption,,loc:fieldclass),,)&'<13,10>'
                      packet = clip(packet) & p_web.CreateOption('Female',1,choose(1 = AIT1:r_val),p_web.combine(p_web.site.style.browseDropOption,,loc:fieldclass),,)&'<13,10>'
                      packet = clip(packet) & p_web.CreateOption('Male',3,choose(3 = AIT1:r_val),p_web.combine(p_web.site.style.browseDropOption,,loc:fieldclass),,)&'<13,10>'
                      packet = clip(packet) & p_web.CreateOption('Other',4,choose(4 = AIT1:r_val),p_web.combine(p_web.site.style.browseDropOption,,loc:fieldclass),,)&'<13,10>'
           
                       end      
            ! End of "Generating Browse Field"
               
        Else
            packet = clip(packet) & p_web._DivHeader('AIT1:r_val_'&AIT1:IH_ID,,net:crc)
            packet = clip(packet) & Left(Format('','@s49'))
        End
      End
      packet = clip(packet) & p_web._DivFooter(Net:NoSend)
      ! Start of "After a Cell value is calculated"
      ! [Priority 5000]
     
      ! End of "After a Cell value is calculated"
      if loc:eip = 1
        do SendPacket
      end
 
        EXIT
        
    if false
    else
      packet = clip(packet) & p_web._DivHeader('AIT1:r_val_'&AIT1:IH_ID,,net:crc)
      If loc:eiptype > 0
          loc:fieldclass = ''
              loc:javascript = 'onchange="B_AimTMP2.eip(this,'''&p_web._jsok('AIT1:r_val')&''','''&p_web._jsok(loc:viewstate)&''');"'
          packet = clip(packet) & p_web.CreateInput('text','inp'&p_web.crc32('AIT1:r_val'&AIT1:IH_ID),AIT1:r_val,p_web.combine(p_web.site.style.browseentry,,loc:fieldclass),0,,'@s1',loc:javascript,,,,) & '<13,10>'
      Else
        packet = clip(packet) & Left(Format('','@s1'))
      End
    End
    packet = clip(packet) & p_web._DivFooter(Net:NoSend)
    !stop('we should not be here')
    if loc:eip = 1
      do SendPacket
    end
! --------------------------------------------------------


kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Dynamically changing EIP for a field - string, drop or none.....
« Reply #1 on: August 26, 2010, 02:37:36 PM »
Hi Ron,

Have you tried adding those 2 fields to the browse and then adding a conditional hide and readonly depending on the data?

Cheers,

Kev