Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: [mv] documentation request for [error] tag



******    message to minivend-users from Mark Stosberg <mark@summersault.com>     ******


Thanks for writing this Bill, it's very useful. 

Based on your pointer, I was able to find the source code myself. I
believe you may have the function of the "required" option wrong, which
is commonly seen in the code with the value of "1", as if it's a boolean
option. Here's the line that's murky:

$text =~ s/{REQUIRED\s+([^}]*)}/$opt->{required} ? $1 : ''/ge; 

Although this a nice compact perlism, It's not straightforward to
understand. It appears to be saying "if the 'required' option is true,
replace the REQUIRED place holder token with the real label, otherwise
just remove the REQUIRED tokens. 

   -mark


Bill Randle wrote:
> 
> How about this, from looking at tag_error():
>     [error var options]
>         var is the error name, e.g. "session"
> 
>     The options are:
>         all=1
>                 display all error messages, not just the one
>                 refered to by <var>. The default is only display
>                 the error message assigned to <var>.
> 
>         text=<optional string to embed the error message(s) in>
>                 place a "%s" somewhere in 'text' do mark where
>                 you want the error message placed, otherwise it's
>                 appended on the end. This option also implies
>                 show_error.
> 
>         joiner=<char>
>                 character used to join multiple error messages
>                 default is '\n'
> 
>         keep=1
>                 keep=1 means don't delete the error messages after
>                 copy; anything else deletes them.
> 
>         show_var=1
>                 show_var=1 means include the variable relating to the
>                 error message as part of the error message (E.g.:
>                 "email: not a valid email address".)
> 
>         show_error=1
>                 show_error=1 means return the error message text;
>                 otherwise just the number of errors found is returned.
> 
>         std_label=<label string for error message>
>                 used with 'required' to display a standardized
>                 error format. The HTML formating can bet set
>                 via the global variable MV_ERROR_STD_LABEL with
>                 the default being:
>                 <FONT COLOR=RED>label_str <<SMALL><I>(%s)</I></SMALL></FONT>
>                 where <label_str> is what you set std_label to and %s
>                 is substituted with the error message. This option
>                 can not be used with the text= option.
> 
>         required=<required str>
>                 used with std_label to specify HTML formatting for the
>                 label_str when no errors were found. The default format
>                 is <B>label_str</B>.
>                 For example, if you set std_label="email" and
>                 required="###" you would see
>                         ### email ###
>                 displayed if there were no errors, or in the case of
>                 an error, you would see:
>                         email (not a valid email address)
>                 in red with the part in parens in small italics.
>                 It would appear from my reading of the source code
>                 that the problem with using HTML tags as the required
>                 string is that they are not closed. I.e., if you use
>                 required="<B><I>", the result is
>                         <B><I> label_str <B><I>
>                 rather than <B><I> label_str </B></I>
> 
>         -Bill Randle
>         billr@exgate.tek.com
> 
> On Mar 21,  3:09pm, Mark Stosberg wrote:
> } Subject: [mv] documentation request for [error] tag
> } ******    message to minivend-users from Mark Stosberg <mark@summersault.com>
>     ******
> }
> }
> } Hello!
> }
> }   I'm interested in some further documentation of the [error] tag. The
> } documentation with the distribution mentions it on these two pages:
> }
> } docindex/06.08.MML_MiniVend_Markup_Language.html
> } docindex/09.00.MINIVEND_TAG_REFERENCE.html
> }
> } But neither of these locations nor the entry in the 'tags' documentation
> } explain what any of the attributes do. In particular, I'm interested in
> } what the following 2 examples do:
> }
> } [error all=1 show_var=1 keep=1]
> } [error all=1 hide=1 comment="Clear errors"]
> }
> } I poked around the source code to see if I could discern the answer, but
> } I couldn't find it.
> }
> }   Thanks for any help!
> }
> }     -mark
> } --
> }   <<-------------------------------------------------------------->>
> } personal website                <    Summersault Website Design
> }    http://mark.stosberg.com/     >       http://www.summersault.com/
> } -
> } To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
> } email with 'UNSUBSCRIBE minivend-users' in the body to
> Majordomo@minivend.com.
> } Archive of past messages: http://www.minivend.com/minivend/minivend-list
> }-- End of excerpt from Mark Stosberg

-- 
  <<-------------------------------------------------------------->>
personal website                <    Summersault Website Design
   http://mark.stosberg.com/     >       http://www.summersault.com/
-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: