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

setValue not really working

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

  • Selwyn Rabins
    replied
    Re: setValue not really working

    of course, you could hide the dummy field so that it is not visible.

    Leave a comment:


  • Steve Wood
    replied
    Re: setValue not really working

    Thank you. I will add a dummy filed to the dialog and use method 2.

    Leave a comment:


  • Selwyn Rabins
    replied
    Re: setValue not really working

    the submit button on a dialog is just a standard button that comes with a pre-defined client-side enable expression. if you want the button to be enabled regardless of the dialog state then just remove the client side enable expression.

    if you don't want to do that then just set some control to a new value and then set it back to its original value.

    e.g.

    var x = {dialog.object).getValue('FIELD1');
    {dialog.object}.setValue('FIELD1','JUNK');
    {dialog.object}.setValue('FIELD1',x);

    Leave a comment:


  • Steve Wood
    replied
    Re: setValue not really working

    Sorry if I hitch hike on this related thread, but I need the Dialog2 equivalent to these two Grid functions:

    {grid.object}._setDetailViewState(true);
    {grid.object}._setRowState(1,true);

    I need to use an external js command to set the Dialog2 dirty (enable the Submit button) without setting values on the form. But I want it to start out with the Submit button disabled as normal. My method works for the Grid using the two functions above.

    Leave a comment:


  • gamma
    replied
    Re: setValue not really working

    Hi Selwyn,

    of course your right. So I created a test component, as you are missing the database backend, and it worked. It took me a while to figure out why. It had to be something in my original component that was not in the test component, that was causing the problem. And I just found it. It was an error on my side. I was missing a variable declaration in JS
    Code:
    	var _d = {};
    So the populate method called afterwards did no longer do what I wanted.
    Sorry about the confusion, but my current save issues do lead to loss of code.

    So thank you for your help. From now on I will always build a test component if I have a problem and if that does not work then I will ask.
    Have good start into the new week!
    Last edited by gamma; 01-30-2012, 06:11 AM. Reason: Not the case after all

    Leave a comment:


  • Selwyn Rabins
    replied
    Re: setValue not really working

    it is really difficult (actually impossible for me) to answer a question like this without having a test component that demonstrates the issue.
    if i have a test component i can run it, duplicate the issue, and suggest a solution.

    thanks.

    Leave a comment:


  • gamma
    replied
    Re: setValue not really working

    Thank you Selwyn! That was exactly what I was looking for!
    Your videos always are great!

    I have another issue with populating the repeating section.
    So the first time a user opens the dialog the Repeating Section has a defined amount of rows , let's say 8. When he clicks the back button the number of rows can change and with it the data of the repeating Section.

    So when the dialog is initialized Following JavaScript code is executed:
    Code:
    {dialog.Object}._setRepeatingSectionRowCount('CONTAINER_1', 8,true,false);
    var _d= {};
    _d['project:1'] = 12;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE1').title = '12';
    _d['project:2'] = 23;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE2').title = '23';
    _d['project:3'] = 31;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE3').title = '31';
    _d['project:4'] = 26;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE4').title = '26';
    _d['project:5'] = 27;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE5').title = '27';
    _d['project:6'] = 29;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE6').title = '29'';
    _d['project:7'] = 30;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE7').title = '30';
    _d['project:8'] = 28;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE8').title = '28';
      {dialog.object}.populate(_d);
      {dialog.object}.prepare();
    The first column (project) populates correctly. So the user clicks the back button the following code is fired
    Code:
    {dialog.Object}._setRepeatingSectionRowCount('CONTAINER_1', 10,true,false);
    var _d= {};
    _d['project:1'] = 12;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE1').title = '12';
    _d['project:2'] = 23;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE2').title = '23';
    _d['project:3'] = 31;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE3').title = '31';
    _d['project:4'] = 24;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE4').title = '24';
    _d['project:5'] = 25;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE5').title = '25';
    _d['project:6'] = 26;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE6').title = '26';
    _d['project:7'] = 27;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE7').title = '27';
    _d['project:8'] = 29;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE8').title = '29';
    _d['project:9'] = 30;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE9').title = '30';
    _d['project:10'] = 28;
    $('{dialog.componentName}.V.R1.PROJECT_A5INSTANCE10').title = '28';
      {dialog.object}.populate(_d);
      {dialog.object}.prepare();
    In the beginning I had this column as a dropdown Box in order to give it the Id and let it show the corresponding text instead. So I thought that might be the problem and changed it to a textbox in order to see the IDs. Here is what I see:
    A5_populateProjectRS.jpg

    It seems like any position/row containing already a value, does not change and just the tow new Rows are populated correctly. The titles/tooltips on the other hand work as intended. In this case the tooltip shows the correct value but the textbox does not. What did I do wrong here?
    The second code block is generated by an Ajax Callback.
    Thanks again!

    Leave a comment:


  • Selwyn Rabins
    replied
    Re: setValue not really working

    What I think you are asking is how to set the Dialog state in the afterValidate event so that the NEXT time it is submitted, the values from the PREVIOUS submission are in the e.oldDataSubmitted object.
    If that is indeed your question, then this video might help you understand more about the issue.


    http://www.ajaxvideotutorials.com/V1...idateEvent.swf

    I am also not sure what you were hoping to achieve by calling the .refreshClientSideComputations() method. This method simply causes the client side calculations (calc fields, show/hide expression, enable expressions, summary value calculations) to be recomputed. It would have no bearing on set dirty fields, or initial field values.

    Leave a comment:


  • gamma
    replied
    Re: setValue not really working

    Originally posted by gamma View Post
    Hi Selwyn,

    I have another question concerning your post #9.
    After clicking on the submit button I process the insert and updates in the server side Event "afterDialogValidate". I want that after the event is finished all data now is in e.oldDataSubmitted. so when the user enters some more data and clicks submit again I only find the fields dirty the user changed since the first submit.
    I tried adding
    Code:
    {dialog.object}.refreshClientSideComputations();
    in the client side event "afterValidate" but that did not help. In
    Code:
    e.repeatingSectionInfo["CONTAINER_1"].dirtyFieldsInSection
    I always find all fields dirty the user has changed since the first time he opend the Window. is there anything similar to "{dialog.object}.refreshClientSideComputations();" I can use in XBASIC in the afterDialogValidate Server side event in order to achieve the same thing?
    Thank you!!
    Hi Selwyn,

    do you by any chance have an anser to my issue in The post #12 (quote above)?
    Thank you very very very much!

    Leave a comment:


  • gamma
    replied
    Re: setValue not really working

    Thank you for the update!

    Leave a comment:


  • Selwyn Rabins
    replied
    Re: setValue not really working

    Based on this thread, we have decided to make the following change to .getValue() when it is used on a Label.

    This will be in the next update:


    Dialog .getValue() on a Label Control - Would always return the original value of the label (even if the label's value had been previously changed using the .setValue() method. This is now fixed so that .getValue() will always read the label value from the control itself.

    The reason that .getValue() previously worked they way it did was that, generically, the .getValue() method returns the control value from the .originalValues[] array in the Dialog Object if the control is NOT dirty, but reads the control value from the control itself if the control is dirty. When you use .setValue() on a Label, the control does NOT go dirty (because a Label control has no concept of being 'dirty' since it is not an input control).

    Leave a comment:


  • gamma
    replied
    Re: setValue not really working

    Good Morning Selwyn,

    that makes sense. I should have known or at least tried something else out. I am learning something new each day and that is actually really fun. The textbox works for me just as well.
    So thanks a million for your help!

    Leave a comment:


  • Selwyn Rabins
    replied
    Re: setValue not really working

    Originally posted by gamma View Post
    Hi Selwyn,

    Thank you very much for the lovely explanation in your first post yesterday. I had used the {dialog.object}.populate(_d);
    but had not known about {dialog.object}.refreshClientSideComputations();
    I hope this will do the trick. But after installing yesterdays patch Build 2365_3859. I am having a error while populating my repeating section. I will try to reproduce the error in a simpler dialog and if I do I will send you that component. UDATE: changing the code to your example in post#9 solved the error.Thank you.

    But first I want to get to your second post:
    I Currently cannot create a video so here is hopefully a better step by step explanation.
    here is a test component I created to show the problem:[ATTACH]30540[/ATTACH]
    Here is what the test dialog looks like: [ATTACH=CONFIG]30541[/ATTACH]

    So we have a label which shows the current month and one that shows the current year.
    A back button which should change the values of the label to the previous month and a next button to change the label values to the next month.
    A textbox in order to enter a value to make the dialog dirty.

    Here are the problems I am having:

    1. For this one you already provided a workaround but for sake of completeness and because the issues may all be related here is the issue again:
    The onClick() event contains following code:
    Code:
    var oldMonth = {dialog.Object}.getValue('Month');
    var newMonth = parseInt(oldMonth) + 1;
    var oldYear = {dialog.Object}.getValue('Year');
    var newYear = oldYear;
    alert('oldMonth: ' + oldMonth);
    
    if (newMonth>11){
    	newMonth = 1;
    	newYear = parseInt(oldYear) + 1;
    }
    alert('newMonth: ' +newMonth+' newYear: ' +newYear);
    {dialog.Object}.setValue('Month',newMonth);
    {dialog.Object}.setValue('Year',newYear);

    When clicking on the next button the value of the labels Month(1) and year(2012) are retrieved and the new value for these controls calculated and set with set value.
    The preview shows now a month value of "2" and a Year of "2012".
    Clicking the next button again you will see that getValue does not retrieve the currently shown month value of "2" but rather the initial value of "1".
    For this you provided a workaround using " $gvs('{dialog.componentname}.V.R1.MONTH');" instead of getValue. This I implemented in the "Back" button and it solves that issue so far.

    2. Changing the label values with the back or next button does not make the dialog dirty (setValue). You can see this as the submit button is still disabled. This may be a feature, one may want it dirty, but I am thinking this may be connected to my 3rd issue.

    3. Incorrect value in e.dataSubmitted:
    • Go to Working preview. There is a debug(1) break in the afterDialogValidate Event.
    • First hit the back button so you can see a month value of 12 and a year value of 2011.
    • In order to make this dialog dirty please enter any value in the textbox e.g. "2".
    • The submit button will be enabled.
    • Click on the Submit button the XBASIC debugger will open.
    • enter "e.dataSubmitted" you will see "e.dataSubmitted := {MONTH=1,YEAR=2012,TEXTBOX1=2}" instead of what I would expect MONTH=12,YEAR=2011

    4. When I then set an simple "enable expression in the client properties of the next button like "if( Year <2012,true,false)" This button will never be enabled as it always thinks the year is "2012"
    Ok, So I hope this explains better what I mean.
    Thank you for your help!
    try changing your two label controls to textbox controls. you will find that your dialog then works.

    you are assuming that the label control acts like other 'input' controls (textbox, text area, dropdown, checkbox, radio button, etc.) it does not. it was assumed that the values in the label control would be static.

    i will look into what would be required to give the 'label' the same behavior as the editable controls.

    in the mean time, you can either convert the labels to input controls and then style them so that they look like labels.
    or put two additional control with a control type of 'hidden' on the dialog. when you set the value of the label controls, also set the value of the corresponding hidden control.
    when you submit, look at the submitted value of the hidden control, not the label control.

    Postscript:

    After further reflection, the way that the Dialog works now is correct and should not be changed.
    Label controls are inherently different from input controls in that an input control can be 'dirty' (since by definition you can type into it and make it dirty),
    but a Label control is NEVER dirty. (i.e. using .setValue() on a Label control does NOT make it dirty).

    because a label control is NEVER dirty, the getValue() method always reads the label's value from the Dialog object's initialValues[] array.
    so if you want to read the current value of a label (after its value had been changed with a setValue(), you would have to read the value directly from the control - using $gvs())


    so, my suggestion of making the Label control into a Textbox, and then styling the textbox so that it looks like a label is the best solution.

    here is how you can make a textbox look like a label. set the style property to:

    background-color: transparent;
    background-image: url(none);
    border-style: none;
    Last edited by Selwyn Rabins; 01-17-2012, 11:05 AM. Reason: more information

    Leave a comment:


  • gamma
    replied
    Re: setValue not really working

    Hi Selwyn,

    Thank you for the info on the new update. I do not have any embedded dialog/grids or controls with the same name in my thread example nor currently in any other Dialog for that matter. I will keep it in mind. I guess you wanted to quote Jowells post #5 instead of my initial one. Thank you for fixing the issue!

    Leave a comment:


  • Selwyn Rabins
    replied
    Re: setValue not really working

    Originally posted by gamma View Post
    Hi!

    I have a month and a year label as well as a back and a next button in my dialog.
    When clicking the back button the whole thing should change to one month earlier. This works exactly one time for me. If I click a second time on "back" the month and year stays the same. So I added alerts to see what data my JS retrieved. And with each click it always gets the same value with "getValue" although if I do a "getValue" at the end of the function it does have the new value and the UI shows the correct value aswell. Here is the code for the onClickEvent of back button:

    Code:
    var oldMonth = {dialog.Object}.getValue('Month');
    var newMonth = parseInt(oldMonth) -1;
    var oldYear = {dialog.Object}.getValue('Year');
    var newYear = oldYear;
    
    alert('oldMonth: ' + oldMonth);
    
    if (newMonth<1){
    	newMonth = 12;
    	newYear = parseInt(oldYear) - 1;
    }
    
    {dialog.Object}.setValue('Month',newMonth);
    {dialog.Object}.setValue('Year',newYear);
    
    alert('newMonth: ' +newMonth+' newYear: ' +newYear);
    Why does the onClick Event always get the original value instead of the newValue which is shown on the UI?
    Thank you!
    In my previous post on this issue I explained why the .getValue() and .setValue() Dialog methods would fail if you used them on Radio Button or Checkbox controls AND you had an embedded Dialog which had Radio Button or Checkbox controls OF THE SAME NAME as controls on the parent Dialog.

    For example, if your parent and child Dialog both had a control called 'Colors' which was configured as a checkbox.

    This issue has now been fixed in the latest pre-release build.

    Last Updated - Jan-17-2012 (Build 2367-3860)

    Leave a comment:

Working...
X