Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Need snippet of RadioButton click and then store value to another dialog Textbox

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need snippet of RadioButton click and then store value to another dialog Textbox

    I have a Radiobutton with four choices and I want to store the value of the Clicked item to be transferred to a TextBox on the same Dialog component.

    I'm not sure of the correct syntax.

    Does anyone have a working snippet of such a common operation?

    It would be greatly appreciated. I've searched the forum and can not find a similar scenario. Could be using the wrong search terms. ????

    #2
    Re: Need snippet of RadioButton click and then store value to another dialog Textbox

    Hi Tom:
    'vColor' control (with 4 radio buttons Blue, Red, Green, White)
    'vtarget' control (textbox)l. If I select Green, you want to insert 'Green' in target control. In the source control (vcolor) in onClick put this:
    {dialog.Object}.setValue('VTARGET',this.value);
    Whatever color is selected, its value is inserted in target control (vtarget). Hope this is what you are looking for.

    Comment


      #3
      Re: Need snippet of RadioButton click and then store value to another dialog Textbox

      or you can just put the name of the Radio Button field in the Calculated Field expression property of the latter field.

      Comment


        #4
        Re: Need snippet of RadioButton click and then store value to another dialog Textbox

        Both of the above responses are really good suggestions and to some degree I have tested both. However my "REAL WORLD" is a bit more complicated and at present I am still trying to write the final code. I'm struggling because Javascript is driving me nuts when it involves Dates.

        Here's my issue. I have a dialog with two date fields :

        -startdate
        -endstart

        I want to make it easier for the user to enter these fields with some general dates, therefore I have my Quick Picks Radiobuttons.

        Radio choices:

        1 week ago|-7
        1 month ago|-30
        1 year ago|-365
        1 month from now|30
        1 year from now|365
        2 years from now|720

        When the user chooses a quickpick, I want that calculated date to be inserted in the startdate and enddate fields.

        Like I said earlier, it's Javascript that's turning this 20 minute exercise into a more than a half day of non-productive waste. All I want to do is add (or subtract) the selected numeric value to TODAY's date and then put that into the startdate and enddate.

        Any working code on this matter would "make my day". I know the puesdo code and principles involved, I'm missing the expertise.

        Thanks,

        Tom W.

        Comment


          #5
          Re: Need snippet of RadioButton click and then store value to another dialog Textbox

          Very doable, however more info is needed. For expl If I pick
          1 month ago what would the startdate, enddate be?
          1 month from now; what startdate, endate?
          Is today's date startdate or enddate or can be either?

          Comment


            #6
            Re: Need snippet of RadioButton click and then store value to another dialog Textbox

            Thank guys but I ended up using Xbasic to solve my problem because I would not be able to sleep tonight if I left it up to Javascript.

            I created a Ajax callback on the Click on the RadioButton. In that function I do this:

            dim nowdate as c
            nowdate = dtoc(date() + val(e.dataSubmitted.radiobutton1) )

            e._set.startdate.value = nowdate

            I'm going to do the same for my field : enddate which has an associated Radiobutton with slightly different choices because they are all suppose to be in the FUTURE.

            To answer your question Gaby, The base date for all the calculations are TODAY's DATE. (ie. date() )

            Again thanks and if you should arrive at a Javascript example, I think I and other users would be interested to see how that was done.

            One weird final note. The click on the radiobutton does not update the field correctly until a SECOND click. This is repeatable and consistent. Wish I could get rid of that "bug".

            Comment


              #7
              Re: Need snippet of RadioButton click and then store value to another dialog Textbox

              Tom:
              Assuming:
              -Choices is set as radio button storing a number ie are set as in your previous post (Description|nbr)
              -The target controls (startdate, enddate) are textboxes
              -Startdate is always today's date (therefore enddate can be in the past or in the future).
              Place the following in the onclick radio button control.
              var d1 = new Date();
              var stdate = d1.getMonth()+1 +'/'+ d1.getDate() +'/'+ d1.getFullYear();
              var y = d1.setDate(d1.getDate()+Number(this.value));
              y = new Date(y);
              var endate = y.getMonth()+1 +'/'+ y.getDate() +'/'+ y.getFullYear();

              {dialog.Object}.setValue('VSTDATE',stdate );
              {dialog.Object}.setValue('VENDATE',endate );
              and see how it goes.

              Comment


                #8
                Re: Need snippet of RadioButton click and then store value to another dialog Textbox

                I had done this previously in javascript...see comments within for guidance.

                Code:
                // Used to quickly select a date range
                
                // onclick javascript code......for the SELECTOR_ID field
                // Assumes that date.js is a linked file to the component (see http://www.datejs.com/ although this is an older library)
                
                // dropdown search field called SELECTOR_ID, Place this in onchange event
                // JOURNALDATE search field set up as range search
                
                
                // Calculate date ranges for date pull down menu
                var today = Date.parse('today').toString('MM/dd/yyyy');
                
                //Choices for Date Picker Drop-down (display|value format) in SELECTOR_ID...copy and paste this in...without //
                //Day - Today|DT
                //Week - Current|WC
                //Week - Next|WN
                //Week - Last 7 days|WL7
                //Week - Next 7 days|WN7
                //Month - Current|MC
                //Month - Next|MN
                //Month - Last 30 days|ML30
                //Month - Next 30 days|MN30
                //Year - Current|YC
                //Year - Next|YN
                //Year - Last 365 days|YL365
                //Year - Next 365 days|YN365
                
                //dropdown field called SELECTOR_ID
                var myChoice = $('{Grid.ComponentName}.S.SELECTOR_ID').value;
                var myStartDate = '';
                var myEndDate = '';
                
                if (myChoice==='DT') {
                	myStartDate = today;
                	myEndDate = today;
                }
                else if (myChoice==='WC') {
                	myStartDate = Date.today().last().monday().toString('MM/dd/yyyy');
                	myEndDate = Date.today().last().monday().add(6).days().toString('MM/dd/yyyy');
                }
                else if (myChoice==='WN') {
                	myStartDate = Date.today().add(7).days().last().monday().toString('MM/dd/yyyy');
                	myEndDate = Date.today().add(7).days().last().monday().add(6).days().toString('MM/dd/yyyy');
                }
                else if (myChoice==='WL7') {
                	myStartDate = Date.today().add(-6).days().toString('MM/dd/yyyy');
                	myEndDate = today;
                }
                else if (myChoice==='WN7') {
                	myStartDate = today;
                	myEndDate = Date.today().add(6).days().toString('MM/dd/yyyy');
                }
                else if (myChoice==='MC') {
                	myStartDate = Date.today().moveToFirstDayOfMonth().toString('MM/dd/yyyy');
                	myEndDate = Date.today().moveToLastDayOfMonth().toString('MM/dd/yyyy');
                }
                else if (myChoice==='MN') {
                	myStartDate = Date.today().add(1).months().moveToFirstDayOfMonth().toString('MM/dd/yyyy');
                	myEndDate = Date.today().add(1).months().moveToLastDayOfMonth().toString('MM/dd/yyyy');
                }
                else if (myChoice==='ML30') {
                	myStartDate = Date.today().add(-29).days().toString('MM/dd/yyyy');
                	myEndDate = today;
                }
                else if (myChoice==='MN30') {
                	myStartDate = today;
                	myEndDate = Date.today().add(29).days().toString('MM/dd/yyyy');
                }
                else if (myChoice==='YC') {
                	myStartDate = '01/01/' + Date.today().toString('yyyy');
                	myEndDate = '12/31/' + Date.today().toString('yyyy');
                }
                else if (myChoice==='YN') {
                	myStartDate = '01/01/' + Date.today().add(1).years().toString('yyyy');
                	myEndDate = '12/31/' + Date.today().add(1).years().toString('yyyy');
                }
                else if (myChoice==='YL365') {
                	myStartDate = Date.today().add(-364).days().toString('MM/dd/yyyy');
                	myEndDate = today;
                }
                else if (myChoice==='YN365') {
                	myStartDate = today;
                	myEndDate = Date.today().add(364).days().toString('MM/dd/yyyy');
                }
                
                //$('{Grid.ComponentName}.S.SELECTOR_ID').value = '';   //optional clear
                $('{Grid.ComponentName}.S.JOURNALDATE').value = myStartDate;
                $('{Grid.ComponentName}.S._TO.JOURNALDATE').value = myEndDate;

                Comment

                Working...
                X