Alpha DevCon 2018
Results 1 to 9 of 9

Thread: Clearing of fields in a Web dialog control

  1. #1
    Ragnar Midtskogen
    Guest

    Default Clearing of fields in a Web dialog control

    Hello,

    I got my dialog designed and working now, but I noticed that when I display the dialog later by linking to it from another page, the contents of the controls are still there. Do I need to clear them, or can this be done automatically based on some setting that affects all controls?

    TIA,
    Ragnar Midtskogen

  2. #2
    Alpha Software Employee Lenny Forziati's Avatar
    Real Name
    Lenny Forziati
    Join Date
    Nov 2001
    Location
    Alpha Software
    Posts
    4,640

    Default RE: Clearing of fields in a Web dialog control

    Ragnar,

    Please post your Web Application Server questions on the Web Application Server board.

    There are a few reasons what you are describing could happen:

    1) The link includes a query string with values for the controls in it. If this is the case, remove that portion of the query string.

    2) The dialog is using sessions variables which still exist and are therefore displayed. Do not use session variables unless necessary. If necessary, you'll need to clear these variables before displaying the page again. This could be done in your dialogs initialization code or as part of your hyperlink.

    3) Your browser is displaying a cached page instead of the page sent by the server. The headers sent by the server by default should prevent this, but you can add the following 3 lines of Xbasic to further prevent caching of your pages

    Response.AddHeader("CacheControl: no-cache")
    Response.AddHeader("Pragma: no-cache")
    Response.AddHeader("Expires: -1")


    -Lenny

  3. #3
    Ragnar Midtskogen
    Guest

    Default RE: Clearing of fields in a Web dialog control

    Thank you Lenny,

    1. No, I do not pass the values.

    2. I do use server variables, copying them from the dialog controls, in order to mak them available to the page I link to from the AfterValidate event code. Do you recommend passing them to that page?
    But I don't see how this would cause the values to appear when the page with the dialog on it are reloaded.

    3. I will try your AddHeader code.

    Ragnar Midtskogen

  4. #4
    Alpha Software Employee Lenny Forziati's Avatar
    Real Name
    Lenny Forziati
    Join Date
    Nov 2001
    Location
    Alpha Software
    Posts
    4,640

    Default RE: Clearing of fields in a Web dialog control

    For number 2, I highly doubt you want server variables. They will be visible to all users of the application, not just the current user. A session variable will at least be restricted to the current user. Can you post a copy of your component?

  5. #5
    Ragnar Midtskogen
    Guest

    Default RE: Clearing of fields in a Web dialog control

    Hi Lenny,

    It occurred to me I am not sure where to add that code.

    I tried adding it to the Activate event of the dialog, did not like that, got this error message:
    Errors in: event.Activate code:
    Response.AddHeader method not found

    I am not much up on HTML, know a little about ASP, but for the most part I am an experienced VB/VBA and Access with a little SQL Server, programmer.

    I attended last year's Alpha conference and took some classes, but have not used it since, so I am fumbling.

    Ragnar

  6. #6
    Ragnar Midtskogen
    Guest

    Default RE: Clearing of fields in a Web dialog control

    I'm sorry, I meant session variables.

    Ragnar

  7. #7
    Ragnar Midtskogen
    Guest

    Default RE: Clearing of fields in a Web dialog control

    Lenny,

    Here is the component

    Ragnar

  8. #8
    Ragnar Midtskogen
    Guest

    Default RE: Clearing of fields in a Web dialog control

    Lenny,

    And they were the problem, when I clear them all is well. John Bowen explained why.

    Ragnar

  9. #9
    Member
    Real Name
    Rob Polley
    Join Date
    Nov 2005
    Posts
    432

    Default Re: Clearing of fields in a Web dialog control

    Ragnar,

    I'm new to dialogs and encountered the problem you described. I'm using local variables, but they stayed on the page after I clicked "submit." I added this code that solved the problem. I'm sure "real" programmers won't like it, but it worked for me, as far as I can tell.

    'Clear the values of the existing variables


    dim SwimNum as c
    dim Choice1 as c
    dim choice2 as c
    dim choice3 as c
    dim choice4 as c

    swimnum = ""
    choice1 = ""
    choice2 = ""
    choice3 = ""
    choice4 = ""

    Thank you.

    --Rob

Similar Threads

  1. Clearing fields
    By Leo Cohen in forum Alpha Five Version 6
    Replies: 3
    Last Post: 06-04-2005, 07:44 AM
  2. paasing grid fields to dialog
    By rlgiordano in forum Web Application Server v6
    Replies: 2
    Last Post: 05-10-2005, 08:15 AM
  3. Can we control loading of calc fields?
    By Howard G. Cornett in forum Web Application Server v6
    Replies: 3
    Last Post: 08-25-2004, 01:23 PM
  4. X-Dialog # of Fields Limit
    By John Gamble in forum Alpha Five Version 5
    Replies: 6
    Last Post: 01-10-2003, 06:04 AM
  5. Clearing form fields
    By Martin in forum Alpha Five Version 4
    Replies: 8
    Last Post: 12-19-2002, 08:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •