Options

Couple Questions on Pages

ozenineozenine Member Posts: 17
edited 2011-03-09 in NAV Three Tier
Good Day,
I have couple questions on pages:
1) when the codeunit calls MyForm.RUNMODAL, how does the NAV knows that in RTC Page "MyPage" needs to be opened instead. Does it go by the name - open page with same name as form?
2) I have 3 fields on the list form A, B, C. Last field (C) can be populated only when first 2 have values in them. So i added some code on OnValidate trigger on the Table which TESTDIELD's both A and B. When i have A and B blank and I enter the value in C I get an error that A is blank. I can use arrows to get to A and change the value, then the error disappears and new one appears saying that B cannot be blank. In this case when i arrow to B and change the value the error does not disappear and stays there preventing me from making a change in C. I have to delete value inC and reenter it again. So I am not sure why for one field I can make a change and error will disappear and on another it would not disappear.
Thanks in advance

Comments

  • Options
    ara3nara3n Member Posts: 9,255
    1. RTC only runs Pages. So all Form.runmodal = Page.Runmodal. Actually RTC runs c# code which has Page.runmodal.


    2. This looks like a bug and you should report it to MS. My guess they'll say it's how it's designed.
    What suppose to happen is that if you get an error, and you fix it. It should revalidate all the fields based on how you entered. Basically follow the same sequence.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    beranberan Member, Microsoft Employee Posts: 80
    I think question 2 is indeed a bug. I have made it a bug for v7, soon I will verify it.
    I cannot make it a hotfix for R2 so please request Microsoft.
    Eric Beran
    Software Design Engineer II
    Dynamics NAV Office 365
    Microsoft

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Options
    ozenineozenine Member Posts: 17
    ara3n wrote:
    1. RTC only runs Pages. So all Form.runmodal = Page.Runmodal. Actually RTC runs c# code which has Page.runmodal.


    2. This looks like a bug and you should report it to MS. My guess they'll say it's how it's designed.
    What suppose to happen is that if you get an error, and you fix it. It should revalidate all the fields based on how you entered. Basically follow the same sequence.

    Thanks for your responses, Rashed.

    1. I guess I am asking, how does RTC knows that I need to run this particular page. where is the link of "Whn this page is run - run that form"?

    2. I will report this. Another question though. If you are saying that it should validate them in the same sequence as were entered then that is not really clear. I entered field C which caused error becuase A was was blank. So i did not change the C, I went to A and entered a value (C still had value in it). So based on what you are saying it should validate C (i entered it first) and then A. But in real life it does A and then C.
    I am just trying to figure out how does it determine sequence of fields to validate. This is crutial on some complex forms like Salesl Lines and such. Should we be writing code differently.....
  • Options
    ara3nara3n Member Posts: 9,255
    1. The link is the Form ID. RTC runs the Page with same ID. So Form 50000 would run Page 50000.


    2. What I meant is that RTC would be doing the validation not you. So just report it. You could as workaround add some code to blank C when entering B. This way the user would have to reenter C to continue.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    ozenineozenine Member Posts: 17
    Thanks Rashed,
    I am just trying to figure out how does RTC determine the sequence of validations. Especially when error is raised. Do you know where I can read on this?

    I think we got spoiled in Classic when the validation is happening right after the input. Here it looks to be a bit different since it can validate multiple fields at the time.
    Thanks
    Oleg
  • Options
    beranberan Member, Microsoft Employee Posts: 80
    We actually did have challenges working with the old Classical validation code and making it possible to edit more fields eventhough a validation error occurs. The solution is best explained by an examble with three fields (A,B, C). Two fields will not show the behavior of the algorithm.

    Let us say

    1) enter a value for (field) A and get a validation error
    2) enter a value for B and get a validation error
    3) enter a value for C this does not give an error
    4) the validation handler (VH) validates the value for A again but gives an error
    5) the VH validates the value for B again and it does not give an error (due to C)
    6) the VH validates the value for A again and it does not give an error (due to C and B)

    Note that the entered values is only kept in the VH if they have errors. Also note that the validation is only done based on the entered fields that did not give error. The server roles back to the row that had no errors. Entering a value that is not giving an error is accepted and updates the servers row even though entered fields have validation errors.
    Eric Beran
    Software Design Engineer II
    Dynamics NAV Office 365
    Microsoft

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Options
    ozenineozenine Member Posts: 17
    Wow, Eric, Exactly what I was looking for.
    So basically the VH will be looping through the Validations until all goes through.

    Just so i fully understand understand, if i had extra field E that required no validation then your scenario would be like this?

    1) enter a value for (field) A and get a validation error

    1.1) enter value for E and do not get error
    1.2) E is submitted to the database even though A is not?

    2) enter a value for B and get a validation error
    3) enter a value for C this does not give an error
    4) the validation handler (VH) validates the value for A again but gives an error
    5) the VH validates the value for B again and it does not give an error (due to C)
    6) the VH validates the value for A again and it does not give an error (due to C and B)

    Very interesting concept.
    Thanks for sharing
  • Options
    beranberan Member, Microsoft Employee Posts: 80
    You introduction of E is interpreted correct. I am looking for the documentation explaining this.
    Eric Beran
    Software Design Engineer II
    Dynamics NAV Office 365
    Microsoft

    This posting is provided "AS IS" with no warranties, and confers no rights.
Sign In or Register to comment.