Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??

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

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.