Validation for the Item No....

PremPrem Member Posts: 34
edited 2004-02-09 in Navision Attain
Dear Friend's

I am trying to validate certain fields in the Item Card... my problem is the item should not be added if those fields are blank..

Regard's

Comments

  • RabeRabe Member Posts: 27
    Hello Prem,

    The easiest way do this would be to add some validation code to the OnInsert trigger of the Item table.

    For Example :

    // Field Validation
    IF (Rec.Description = '') THEN
    ERROR('Please provide a Item Description before inserting a new item.');

    Please note that this might cause some user irritation -> the reason being let's say you validate 5 fields. If they filled in all the information and only forgot about 1 of the fields then when inserting it will pop up with the error and the user will have to redo all the input again...

    Another way to do this might be to put the code on the form that would prevent the user from leaving the form until all the fields are filled in.

    Hope it helps

    Best Regards
    Rabe
  • PremPrem Member Posts: 34
    Dear Rabe..

    Adding code in the oninsert or onmodify trigger will not solve this problem... my problem is if any one of the validation fileds is blank , that record should not get into the system.

    Regard's

    Prem
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • PremPrem Member Posts: 34
    Dear Luc

    I had tried all this... as i told u if i just create a record and then navigate to the prvios or next record.. the blank record is created... this is what i want to avoid. and also there is problems when u use the delayedinput when u have table relations

    Regard's

    Prem
  • Timo_LässerTimo_Lässer Member Posts: 481
    :idea: Therefore I've a little suggestion:
    If you have mandatory fields, it would be desirable to show it to the user, so he knows this before he gets the error. :wink:
    I have two ideas to do this:
    1. Highlight the mandatory fields with a background color (e. g. yellow)
    2. Format the label of the mandatory fields bold.

    The customer will be thankful for this.
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • PremPrem Member Posts: 34
    Dear Timo..

    Its only a visual check... i have already done it....(even tough not a smart way ) but we are talking about a system validation..

    Regard's
  • GoMaDGoMaD Member Posts: 313
    I know it's a coding solution but have you tried
    testfield(rec.fieldname);
    

    Greetings,
    Now, let's see what we can see.
    ...
    Everybody on-line.
    ...
    Looking good!
  • PremPrem Member Posts: 34
    Dear Gomad

    Those are the basics which i have done...

    Regard's
  • YuriYuri Member Posts: 16
    I can suggest you another way:
    1. Block Items after insert (field Blocked must be TRUE, and it couldn't be editable :!: )
    2. Provide some function to test the item
    if required fields are not blank, then you "Unblock" item, in the other case
    you can demand to fill up your field
Sign In or Register to comment.