Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I am not sure what your question is this time around. You write...
The above works with the template but I'm not sure if I'm missing something.
If it works, then you are not missing anything. Your template code is, though, a bit confusing. You have typed (perhaps, a typo) --
<select name="school_id"><option selected value="1"><option selected v +alue="0">Select<tmpl_loop name=options> <option value="<tmpl_var name=school_id>"><tmpl_var escape=html name=s +chool></option></tmpl_loop> </select>
Perhaps you meant --
<select name="school_id" size="1"> <option selected value="0">Select school</option> <tmpl_loop options> <option value="<tmpl_var school_id>"><tmpl_var escape=html school> +</option> </tmpl_loop> </select>
Wrt your original question, no matter how you do it, just remember that in H::T each variable is a scalar, while each loop is an array of hash(es). You'll be ok. If you want to not set anything, you can do one of two things -- turn die_on_bad_params off by setting it to 0, or better yet, make sure you set the value to an empty reference. Actually, you can do one more thing -- use tmpl_if to check for existence of a var before trying to display it. Good luck.

In reply to Re: Re: Re: HTML::Template question - tmpl_if by punkish
in thread HTML::Template question - tmpl_if by kiat

Title:
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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found