Alpha Video Training
Results 1 to 4 of 4

Thread: How to include own code for ADD,EDIT & DELETE

  1. #1
    Jon Lau
    Guest

    Default How to include own code for ADD,EDIT & DELETE

    HI,

    Where can I incl my code if after the user click 'ADD', 'EDIT' or 'DELETE' button? Eg. Default the username to the login ID after user add a new record. Or maybe log the system time when the user edit the record.

    Actually, alpha should document those embed points that we code our own source. It would be easy to control the web app.

  2. #2
    "Certified" Alphaholic
    Real Name
    Peter Wayne
    Join Date
    Apr 2000
    Posts
    1,728

    Default RE: How to include own code for ADD,EDIT & DEL

    Reportedly the next version of the grid components will have an afterSubmit event that you can program.
    The dialog component already has an AfterValidate event, and you can use that event, if you're using a dialog.
    In the meantime--assuming you are using a grid--you can program your own afterSubmit event by inserting code in the top of your A5W page that looks something like this:
    Code:
    if eval_valid("myComponentName_Button_Submit") then
       ' your own processing goes here
    end if
    Delete Tmplt
    Dim Tmpl as P
    etc.

    Each component's Submit button is named as myComponentName_Button_Submit.

    Another way of doing what you want is to put hidden input variables on your page. For example, if the user's name is in session.user_name, then you can modify the A5w script that generates the page to include the lines
    Code:
    html=
    
    " name="user"> %str%
    ? html 
    %>
    Then when the form is submitted, you will have created a variable, request.variable.user (of course, you already have a variable session.user_name, so this is a little superfluous in this example!).

  3. #3
    "Certified" Alphaholic
    Real Name
    Peter Wayne
    Join Date
    Apr 2000
    Posts
    1,728

    Default RE: How to include own code for ADD,EDIT & DEL

    Sorry, the html ate up my code. Trying again:

    Reportedly the next version of the grid components will have an afterSubmit event that you can program.
    The dialog component already has an AfterValidate event, and you can use that event, if you're using a dialog.
    In the meantime--assuming you are using a grid--you can program your own afterSubmit event by inserting code in the top of your A5W page that looks something like this:

    "%A5
    if eval_valid("myComponentName_Button_Submit") then
    ' your own processing goes here
    end if
    Delete Tmplt
    Dim Tmpl as P
    etc.


    Each component's Submit button is named as myComponentName_Button_Submit.

    Another way of doing what you want is to put hidden input variables on your page. For example, if the user's name is in session.user_name, then you can modify the A5w script that generates the page to include the lines

    "%a5
    html=""%str%
    "input type=hidden value="%str% + session.user_name+ ""%str%
    " name="user"" %str%
    ? html
    %"


    Then when the form is submitted, you will have created a variable, request.variable.user (of course, you already have a variable session.user_name, so this is a little superfluous in this example!).

  4. #4
    Jon Lau
    Guest

    Default RE: How to include own code for ADD,EDIT & DEL

    Peter,

    Thank you so much! I will try it out.

Similar Threads

  1. Edit code editor toolbar.
    By CALocklin in forum Archived Wishlist
    Replies: 5
    Last Post: 12-27-2008, 02:56 AM
  2. Edit and delete Operation
    By David Priest in forum Alpha Five Version 6
    Replies: 0
    Last Post: 02-17-2005, 06:40 AM
  3. Include, Table?
    By Keith Hubert in forum Alpha Five Version 5
    Replies: 2
    Last Post: 10-20-2003, 05:01 AM
  4. code edit
    By Tom Patten in forum Alpha Five Version 4
    Replies: 3
    Last Post: 07-26-2001, 05:29 AM
  5. Query, how to Delete or Edit
    By Bob Tuttle in forum Alpha Five Version 4
    Replies: 3
    Last Post: 07-07-2000, 07:38 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
  •