How to calculate default field values on online form

 3 Replies
 0 Subscribed to this topic
 17 Subscribed to this forum
Sort:
Author
Messages
Woozy
Veteran Member
Posts: 709
Veteran Member
    I have created a custom online inquiry form.  When the form opens, I would like to populate some of the query parameters with calculated default values (which the user could override).  Is this possible in 4GL?  

    For example, I'd like to pre-populate from/thru date fields based on the current date.

    From my testing, It appears that none of the PD code is called until the user clicks Inquire/Next/Previous, which is too late for my purposes. 

    Am I missing something?
    Kelly Meade
    J. R. Simplot Company
    Boise, ID
    Venkat
    Advanced Member
    Posts: 22
    Advanced Member
      For what I have realized over the past versions (from 7.x to 9.x), the default values can be defined only in .scr file and that has to be a constant. Your conclusion about control passing over to PD code is correct. The screen is presented to the user first without any of the PD code being executed. Only upon clicking a button the control passed to the PD code. This is true for both online and batch forms.
      Woozy
      Veteran Member
      Posts: 709
      Veteran Member
        Thanks Venkat.  I'll have to work around it.  I appreciate your help!
        Kelly Meade
        J. R. Simplot Company
        Boise, ID
        Jason Beard
        Veteran Member
        Posts: 124
        Veteran Member
          I know this is an old post, but if you are using Portal/Design Studio you can use the forms on init method to set these types of values...
          Jason Beard
          617-548-5568
          jabeard3@gmail.com