NetTalk Central

Author Topic: Hide/Unhide Form Fields based on another Field Entry  (Read 2800 times)

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Hide/Unhide Form Fields based on another Field Entry
« on: March 22, 2014, 11:53:58 AM »
C9.0  NT 7.35

I need to hide two fields from the form until another field is entered via a drop, and in the server side code for the drop, I look up the record for the selected drop field and do a SSV of a flag to indicate if the following two fields should be displayed for entry or not.

If I am opening an existing record, the template hide/unhide conditions for the two fields are followed.  But, if inserting a new record, the fields are hidden (which would be correct until the drop down field is filled in).  I do ask the templates to reset the two fields after the server side code that does the SSV of the control field.  But, the two fields remain hidden.

The hide/unhide template entries for the two fields are:

Include:  p_web.gsv('PCN:AllowFirstFruit') = 'Y'
Hide:      p_web.gsv('PCN:AllowFirstFruit') <> 'Y'

Note - the PCN:AllowFirstFruit session value contains the correct value

So, what processes are needed to be followed to do this, what embeds are used to be able to redisplay the form with the new decision regarding hide/unhide after the drop field is selected.
Thanks,
Mike Springer

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: Hide/Unhide Form Fields based on another Field Entry
« Reply #1 on: March 23, 2014, 12:49:25 AM »
Your problem is the use of the include. This means that the control is not even populated on the form unless allowfirsyfruit is 'Y' on creation of the form, so unhiding has no effect. You should work on hide condition only
i.e just use the hide command and reset the field. If the value is 'Y' then it will display, if not then it won't
« Last Edit: March 23, 2014, 12:56:04 AM by terryd »
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

springguy

  • Full Member
  • ***
  • Posts: 195
    • View Profile
    • Email
Re: Hide/Unhide Form Fields based on another Field Entry
« Reply #2 on: March 23, 2014, 02:17:01 AM »
Terry,
I feel like saying Duh.  Yep, removed the Include condition and it works fine.  I wasn't even thinking about the fact the browser would not even have the fields to Unhide if they were never included in the first place. 

Thanks for your insight.
Mike