G'day yedukondalu,

"can'yt figure out whats wrong in this code?"

If I could run your code, I'd take a look; however, it's clear that it will die with something like

Can't open the file details.txt No such file

so there's little point in me trying.

Please provide a cutdown version, that only contains code relevant to your problem, which we can run — see "How do I post a question effectively?" for more details about this.

Also, that's a terrible title. Consider changing it to something meaningful, perhaps: "Problem validating Tk::Entry field"

"When trying to validate the age the dob validation pops without calling it's subroutine."

I can't tell what your problem is from this description. My best guess about the first part is that "-validatecommand => \&check_age" is somehow acting as if it was coded as "-validatecommand => \&validate_dob"; however, the last part is just far too vague (what's calling who's unnamed subroutine?). Please write a description which is descriptive!

As far as I can see, none of your validation routines are reading the arguments passed to them. Please see the Tk::Entry documentation; in particular, the VALIDATION section. You may also want to look at Tk::callbacks.

Your actual validation checks are also problematic. As an example:

sub check_age { if ((!$age) || ($age=~ m/[a-z]/i)) { $age_entry->messageBox( -icon => 'error',-message => 'age should +not contain characters' ,-type => 'Ok'); ...

According to this, an age of, say, "~!@#$%^&*()_+" would be perfectly OK. I don't think so!

I'd be more than happy to help you. Help me to do so.

— Ken


In reply to Re: can'yt figure out whats wrong in this code? by kcott
in thread can'yt figure out whats wrong in this code? by yedukondalu

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.