×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    230

    Question Validation of datafield!!

    Hi..all,

    I have created one query dialog which asks for number. Just now I have setted default number as 111. I have written code like this:

    TBool CmyappDialog::OkToExitL( TInt aButtonId )
    {
    TInt iButtonId=aButtonId;

    if(iButtonId == EAknSoftkeyDone)
    {


    if( ValidateInitCode() ) //Error here while debugging
    {
    iContainer->DisplayFormL( R_MYAPP_FORM_DIALOG);
    }
    }
    return EFalse;
    }

    TBool CmyappDialog::ValidateInitCode()
    {
    TBool isValid = EFalse;
    initcodeEdwin = static_cast<CEikEdwin*>(ControlOrNull(EInitCode));
    initcodeEdwin->GetText(iCode);

    TBuf<25> code;//Error here while debugging
    code.Copy(_L("111"));
    if(iCode==code)
    return ETrue;
    else
    return EFalse;
    }
    But It doesn't work and program crashes!

    Kindly help.

    Regards,
    Symbee
    Last edited by symbee; 2006-10-16 at 06:36.

  2. #2
    Regular Contributor
    Join Date
    Dec 2005
    Location
    Bangalore, India
    Posts
    90

    Re: Validation of datafield!!

    can you check what ControlOrNull() method returns... does it return NULL?
    Can you debug and let know where(line no) does it crash?
    Best Regards
    -Boumitran

  3. #3
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    230

    Re: Validation of datafield!!

    Ya I have written in code tht where I get errors!!

    And I had done the same thing previously like this code:
    initcodeEdwin = static_cast<CEikEdwin*>(ControlOrNull(EInitCode));
    initcodeEdwin->GetText(iCode);
    At that time it was fetching data correctly from edwin field. and I had got the clue for this from here only!! I m surprised that the same thing doesn't work here!!

    Regards,
    symbee

  4. #4
    Regular Contributor
    Join Date
    Dec 2005
    Location
    Bangalore, India
    Posts
    90

    Re: Validation of datafield!!

    that looks very strange.
    the statement
    TBuf<25> code ;
    can crash only if you use exceed the stack size.
    does this happen in your case?
    default stack size is 8K
    you can define EPOCSTACKSIZE in mmp if you are going to use more than this.

    hope this helps
    Best Regards
    -Boumitran

  5. #5
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    230

    Re: Validation of datafield!!

    Normally such error comes when the code above that statement is wrong!! n I am doubtfull about that only...bcoz I tried this:
    initcodeEdwin = static_cast<CEikEdwin*>(ControlOrNull(EInitCode));
    initcodeEdwin->GetText(iCode);

    CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote;//ERROR
    dlg->ExecuteLD( iCode );

    TBuf<25> code;
    code.Copy(_L("111"));
    if(iCode==code)
    return ETrue;
    else
    return EFalse;
    and error as written in code occurs!:((

    Symbee

  6. #6
    Regular Contributor
    Join Date
    Dec 2005
    Location
    Bangalore, India
    Posts
    90

    Re: Validation of datafield!!

    may be you can TRAP the satement

    TRAPD(aError, CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote; ) ;

    and check for aError.
    Check whether the code panics? if yes note the panic code in emulator.
    Best Regards
    -Boumitran

  7. #7
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    230

    Re: Validation of datafield!!

    There is no problem in the line CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote as it works fine for some iNote that I have checked!

    I think error is in
    initcodeEdwin = static_cast<CEikEdwin*>(ControlOrNull(EInitCode));
    initcodeEdwin->GetText(iCode);
    Can anyone help me regarding this??

    Regards
    Symbee

  8. #8
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,347

    Smile Re: Validation of datafield!!

    Hello Symbee,

    It seems that problem resides in:
    initcodeEdwin = static_cast<CEikEdwin*>(ControlOrNull(EInitCode));
    initcodeEdwin->GetText(iCode);
    Anyways try:

    Code:
    TBuf<25> iCode;
    CEikEdwin* initcodeEdwin = static_cast<CEikEdwin*>(ControlOrNull(EInitCode));
    if(iniicodeEdwin)
    {
            initcodeEdwin->GetText(iCode); 
    }
    Regards.
    Kiran.

  9. #9
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    230

    Re: Validation of datafield!!

    Thanx Kiran,

    I tried what u suggested. But now it doesn't do anything on Done command!!( for query dialog,I have used DONE_BACK cba )

    Symbee

  10. #10
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,347

    Smile Re: Validation of datafield!!

    Hello Symbee,

    That's what i feared.
    Anyways have you debugged your code?
    Does your function go into if(.....)?
    Do u get value in iCode?

    Just check out your code.

    Regards.
    Kiran.

  11. #11
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    230

    Re: Validation of datafield!!

    Hi Kiran,

    I debugged the code but it doesn't shows any error!! But I think it doesn't take Done Key and even not any panic!

    Symbee

  12. #12
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    230

    Re: Validation of datafield!!

    Somebody plz help me...

    I have checked all possibilities by putting messege dialog..It doesn't enter in this if statement!!

    if(initcodeEdwin)
    {
    initcodeEdwin->GetText(iCode);
    }

    Symbee

  13. #13
    Regular Contributor
    Join Date
    Apr 2006
    Location
    India
    Posts
    383

    Re: Validation of datafield!!

    If u dont mind, can u plz brief 1s again what exactly u wanna do with the dialog??
    Regards,
    Shilpa Kulkarni

  14. #14
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    230

    Re: Validation of datafield!!

    Hi Shilpa..

    I am creating a query dialog which takes some code from user and I have taken it as 111 for now. I want to validate it and then if validated, it will open new dialog. I stuck with validation part!! code is like this and I have indicated error part also.

    TBool CmyappDialog::OkToExitL( TInt aButtonId )
    {
    TInt iButtonId=aButtonId;

    if(iButtonId == EAknSoftkeyDone)
    {


    if( ValidateInitCode() ) //Error here while debugging {
    iContainer->DisplayFormL( R_MYAPP_FORM_DIALOG);
    }
    }
    return EFalse;
    }

    TBool CmyappDialog::ValidateInitCode()
    {
    TBool isValid = EFalse;
    initcodeEdwin = static_cast<CEikEdwin*>(ControlOrNull(EInitCode));
    initcodeEdwin->GetText(iCode);

    TBuf<25> code;//Error here while debugging
    code.Copy(_L("111"));
    if(iCode==code)
    return ETrue;
    else
    return EFalse;
    }
    so I know that error occurs bcoz of this code

    initcodeEdwin = static_cast<CEikEdwin*>(ControlOrNull(EInitCode));
    initcodeEdwin->GetText(iCode);


    Kiran helped me to solve that by suggesting this

    TBuf<25> iCode;
    CEikEdwin* initcodeEdwin = static_cast<CEikEdwin*>(ControlOrNull(EInitCode));
    if(iniicodeEdwin)
    {
    initcodeEdwin->GetText(iCode);
    }
    bt not successfull yet:(

    Plz help if u get something

    Regards,
    symbee

  15. #15
    Regular Contributor
    Join Date
    Apr 2006
    Location
    India
    Posts
    383

    Re: Validation of datafield!!

    Is it a query or form(CAknForm)??
    U wanna check whether the number entered = 111??
    Am I guessing right??
    Just make me clear so that I may help u.
    Regards,
    Shilpa Kulkarni

Similar Threads

  1. Form Validation
    By divyas in forum Mobile Java General
    Replies: 2
    Last Post: 2006-05-23, 12:06
  2. user validation using gprs connection
    By papad06 in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2005-08-13, 14:13
  3. HTTP/1.1 400 Message Validation Failed
    By muzilli in forum General Messaging
    Replies: 0
    Last Post: 2004-03-31, 22:12
  4. Response code: 400 Message Validation Failed
    By yaoshan0742 in forum General Messaging
    Replies: 1
    Last Post: 2002-11-18, 10:07
  5. MMS Validation error
    By pgianf in forum General Messaging
    Replies: 3
    Last Post: 2002-06-19, 06:48

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×