Alpha Video Training
Results 1 to 6 of 6

Thread: How to change control values as the user enters information

  1. #1
    Member
    Real Name
    Donna Frederick
    Join Date
    Jun 2011
    Posts
    198

    Default How to change control values as the user enters information

    I need to know how to update a value in a control in a DIALOG2 component based on information input in previous controls. My example is a begin and end date in two textbox controls. If the user puts a date in the begin date control, I want to update the end date value to equal the begin date (if the end date preceeds the begin date). The question is how do I do that in Alpha Five. I have tried a few things but nothing thus far has worked. You help with this is appreciated.

    Thanks.

  2. #2
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,625

    Default Re: How to change control values as the user enters information

    Posting what you have done already is a great place to start the conversation....
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  3. #3
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to change control values as the user enters information

    Borrowing what I learned in another post.

    Code:
    DIM SHARED Startd as D
    DIM SHARED Endd as D
    DIM SHARED varC_result as C
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("Alpha Five",<<%dlg%
    {region}
    Start Date:| [%DATE;P=popup.calendar(dtoc(Startd));I=popup.calendar%.16Startd!Startd_*];
    End Date:| [%DATE;P=popup.calendar(dtoc(Endd));I=popup.calendar%.16Endd!Endd_*];
    {endregion};
    {line=1,0};
    {region}
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%,<<%code%
    if left(a_dlg_button,7) = "Startd_" then 
    	if a_dlg_button = "Startd_killfocus" then 
    		Startd = ctod(dtoc(Startd))
    	end if 
    	Endd = Startd'when the user selects a value for the first date, set the other variable to it
    	a_dlg_button = ""
    end if 
    
    if left(a_dlg_button,5) = "Endd_" then 
    	if a_dlg_button = "Endd_killfocus" then 
    		Endd = ctod(dtoc(Endd))
    	end if 
    	a_dlg_button = ""
    end if
    %code%)

  4. #4
    Member
    Real Name
    Donna Frederick
    Join Date
    Jun 2011
    Posts
    198

    Default Re: How to change control values as the user enters information

    I tried setting up a Ajax Callback in the Javascript onchange event of the begin date control. The function name in the callback is AdjustEndPeriod. I wrote this in the Xbasic Function Declaration :

    function AdjustEndPeriod as c (e as p)

    dim eperiod as T
    dim bperiod as T
    eperiod=convert_type(e.DataSubmitted.EndPeriod,"T")
    bperiod=convert_type(e.DataSubmitted.BeginPeriod,"T")
    if eperiod < bperiod
    e._set.EndPeriod.value = bperiod
    end if

    end function

    I put a debug(1) in the code, but never see it triggered. I offered this information in another thread and no one offered a viable solution.

    The code in the last post doesn't look like it would be used in a web application. Of course, I'm speaking from my little knowledge base.

  5. #5
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to change control values as the user enters information

    I tried setting up a Ajax Callback in the Javascript onchange event of the begin date control.
    Do you perhaps mean to post in one of the Application Server areas as opposed to here (the desktop area.)?
    Last edited by Stan Mathews; 11-01-2011 at 09:25 AM. Reason: Thread moved to proper forum... thanks for id-ing it...

  6. #6
    Member
    Real Name
    Donna Frederick
    Join Date
    Jun 2011
    Posts
    198

    Default Re: How to change control values as the user enters information

    Yes, I apologize that this was posted in the wrong area.

Similar Threads

  1. Replies: 1
    Last Post: 03-20-2006, 04:52 PM
  2. highlight a row when user enters in a browse
    By Lynda Huddleston in forum Alpha Five Version 5
    Replies: 9
    Last Post: 09-05-2005, 04:49 PM
  3. Multi User Information File
    By Gordon Figg in forum Alpha Five Version 4
    Replies: 1
    Last Post: 11-27-2003, 07:18 AM
  4. Alpha 5 V4.5 Multi-user-information
    By Larry Mc Carthy in forum Alpha Five Version 4
    Replies: 5
    Last Post: 03-05-2002, 03:28 PM
  5. Multi-User Information File
    By Michael White in forum Alpha Five Version 4
    Replies: 3
    Last Post: 11-16-2001, 06:58 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
  •