Products and Services
 
Loading ...
 
I've forgotten my password.
  User ID or Email Address:
  Password:
      to    
    check my account
    read my email
    anti-spam
    usage report
    sign up for a new user

Please enter your Username and Password before clicking the above links.
  >> Products >> BEE Web Platform >> Developer >> Programming       <=  =>      <  1  2  3  4  5  6  >   A Taste of BEE

Now you have seen those dual syntax, quotation rules, arrays of strings and so on, but what does BEE offer better than what you've been using already?

Well, before we go into those one-liner authentication, online web content editing, automatic database connection, remote module invocation and many other features, just look at this simple example:

showprice.htm
$10 for a Small jacket.
<form action="showprice.htm">
<select name=size>
<option value="">--Pick a size--</option>
<option value="S">Small</option>
<option value="M">Medium</option>
<option value="L">Large</option>
</select>
<input type=submit value=Go>
</form>

This is a typical online form for the user to select an option from the list.  The form is submitted back to the same page to display the price of the selected size.  (How the price is determined is not the point of interest here.)

One problem with this form is that the selection is always on "--Pick a size--" to start with.  Even after the user has picked "Small" and clicked Go, after the form submission, the selection will come back to the first option on the list.

What you want is to include the attribute "selected" into the option tag that the user picked.  There are many ways to do this in other languages.  With BEE, it can be simply done by using variable alone, like this:

showprice.htm
$10 for a Small jacket.
<bee var=sel: value=selected>
<form action="showprice.htm">
<select name=size>
<option value="">--Pick a size--</option>
<option value="S" $>Small</option>
<option value="M" $>Medium</option>
<option value="L" $>Large</option>
</select>
<input type=submit value=Go>
</form>

After the user picked "S" (for Small), "" will evalute to "S".  The BEE Tag at line 2 assign the value "selected" to the variable "sel:S".  So $ (a "naked" BEE variable in HTML code) in the "option" tag for "Small" evaluates to "selected" while $ and $ still evalute to blank.  The source will look like this:

showprice.htm
$10 for a Small jacket.

<form action="showprice.htm">
<select name=size>
<option value="">--Pick a size--</option>
<option value="S" selected>Small</option>
<option value="M" >Medium</option>
<option value="L" >Large</option>
</select>
<input type=submit value=Go>
</form>

While you can use BEE Variables to provide simple solutions to everyday problems, you can also create more complex variables to achieve specific tasks.  Here is a complex expression used in real programs (the "menu" method of the database object "dbobj"):

Expression can be at left-hand-side of an assignment to make up the variable name.  In the XML object, there is an assignment like this:

this%attr_namespace_: = "";

We are not going into further details, but if you are interested, more information can be found in the BEE Variable section of the BEE Reference.

Back   Next   


Print     <=  =>      <  1  2  3  4  5  6  >  
Read my email