3.6.1.1 The comments forms



The Siteseed comment form system allows the creation of a limited number of form models. The data gathering fields in this type of form is the following:
  • User name;
  • User e-mail;
  • Comment title;
  • Comment text;

The HTML code for the form may contain any or all of the four aforementioned fields
so as to enable the gathering of user information. In the HTML code, the following names should be assigned to the fields:
  • User name: pubcom_name (former pubcom_nome)
  • E-mail: pubcom_email
  • Comment title: pubcom_title
  • Comment text: pubcom_text (former pubcom_texto)
  • Classification: pubcom_class

A predefined field value, containing information about the currently registered user, may be set by using the following Comments Macros:
  • Current User login: -pubcom_myname-
  • Current User FullName: -pubcom_myfullname-
  • Current User email: -pubcom_myemail-

An example of an HTML code for a simple comment form would be the following:
Name:
<input type="text" name="pubcom_name" value="-pubcom_myfullname">
<br>
E-mail:
<input type="text" name="pubcom_email" value="-pubcom_email">
<br>
Title:
<input type="text" name="pubcom_title">
<br>
Comment:
<input type="text" name="pubcom_text">

<input type="submit" value="Submit">

In the example above, the initial values of the name and e-mail fields are filled with two variables (-pubcom_myfullname- and –pubcom_myemail-). These variables are only to be inserted should the Siteseed user registration be completed.
Hence, if a user logs onto the website and if he/she intends to send a comment, the name and e-mail fields will be automatically filled in with the respective data.


3.6.1.2 Forms for sending e-mail



Forms for sending e-mail allow the gathering of all user information that is subsequently processed by the system and sent to an e-mail account. This type of form may contain one
or more fields to be filled in by the website user. Besides these fields, the HTML form for sending e-mail must contain the following hidden form fields:
  • A subject field with the e-mail subject;
  • An e-mail recipient field with the destination e-mail address;

You will find below an example of an HTML code form for sending an e-mail to a "Sentence of the Week" contest:
<!-- User info fields -->
My e-mail:
<input type="text" name="e-mail"><br>
My sentence:
<input type="text" name="sentence">
<br>
<!-- Required hidden fields -->
<input type="hidden" name="subject" value="Sentence of the Week">
<input type="hidden" name="receiver_email" value="sentence@sentencecontest.com">
<input type="submit" value="Submit">


The result of submitting this form would be to send an e-mail with the subject "Sentence of the Week", to the address sentence@sentencecontest.com, with two text lines, one with the user e-mail and the other with the sentence.


3.6.1.3 The login forms



The login forms allow registered users of a website to identify themselves in order, for instance, to access restricted areas of the site. Usually this type of form contains only login and password fields. However, they can also include any other type of information. The fields thay may be used in the form, together with the Macros that identify them, are listed in the table on the right side of the form editor.



The form should always contain the fields in the user field editor marked as "Required to Login".



In addition, it is necessary to define the redirection URLs in the Login Fields table, on the right side, above the Macros table. These fields could be used to redirect the user to a specific welcome page, in case of a successful login, or to an error page in case of error during login:
  • url_ok: Redirection in case of a successful login.
  • url_error: Redirection in case of error during the login procedure (e.g. wrong login or password).

Example of an HTML code for a login form:
Login:
<input type="text" name="$1$">
<br>
Password:
<input type="text" name="$2$">

<input type="submit" value="Submit">

The $1$ macro corresponds to the login field and the $2$ macro to the password field.

NOTE: In previous versions, a hidden field named success_log was required in the HTML code. Its value indicated the id of the article to which the user was redirected after successful login. For compatibility with previous versions, it is still possible to use such field, provided that the url_ok field is empty.


3.6.1.4 The user registration forms



The user registration forms are used to gather user information that will be saved in the user registry. Such information may be used by to show user-specific content or to define user access to restricted areas of the site. These same forms enable the users to make modificate their personal data at a later stage. The fields thay may be used in the form, together with the Macros that identify them, are listed in the table on the right side of the form editor. All fields marked as ";Required to Register" should be included in the HTML form.



It is worth mentioning that, should it be so desired, as the user inserts the data, he/she may be obliged to confirm the information, the confirmation field takes on the following name: Fieldname_confirmation. For instance, if the user is required to reconfirm his/her password, then the confirmation field name should be named password_confirmation.

Example of an HTML code for a registration form:
Name:

<input type="text" name="$5$">
<br>
E-mail:
<input type="text" name="$3$"><br>
Login:
<input type="text" name="$1$"><br>
Password:
<input type="text" name="$2$">
Password confirmation:
<input type="text" name="password_confirmation">

<input type="submit" value="Submit">

...

In addition, it is necessary to define the redirection URLs in the Register Fields table, on the right side, above the Macros table. These fields could be used to redirect the user to a specific page, in case of the user successfuly submits a new registration form or edits his/her personal data, or to an error page in case of error:
  • url_ok: Redirection in case of a successful new registration.
  • url_error: Redirection in case of a general error during the registration procedure.
  • url_change: Redirection in case of the user successfuly edits his/her personal data.


By pressing the "Advanced button" on the top right of the fields box, three new redirection options will be shown:

  • url_unique_error: Redirection in case the user tries to fill in a value already in use by another user, to a unique field (for instance the login field). The name and value of the fields whose value is already in use are stored in a temporary cookie array named unique_fields, that may be used in the page specified by url_unique_error to generate an error message showing all the unique fields in use. The value of each element of the array is available as $unique_fields["-name-of the-field-"].

  • url_mandatory_error: Redirection in case the user forgets to fill in one or more mandatory fields. The name of those fields is stored in a temporary cookie array named mandatory_fields, that may be used in the page specified by url_mandatory_error to generate an customized error message, similarly to the unique fields error page exemplified above.

  • url_confirmation_error: Redirection in case one or more field confirmations (like password confirmation ) fails. The name the fields whose confirmation failed are stored in a temporary cookie array named confirmation_fields, that may be used in the page specified by url_confirmation_error to generate an custom error message.

    Example:
    If the url_unique_error field contains "index.php?headline=20&visual=1", then Page Object #20 would be a dynamic page object where the folowing PHP code would display the name and values of all fields already in use:
    <?
    
    if ($unique_fields)
    {
    print "There are some user fields already in use:";
    reset($unique_fields);
    while ( list ( $field_name,$field_value ) = each ( $unique_fields ))
    {
    print ("<br>$field_name :\"$field_value\"");
    }
    }
    ?>

    or, more specifically:
    <?
    
    if ($unique_fields["login"])
    {
    print "There login you have chosen ($unique_fields["login"]) is already in use.";
    }
    ?>


    Similarly, if url_mandatory_error field contains "index.php?headline=21&visual=1", then Page Object #21 would be another dynamic page object where the folowing PHP code would display the name all missing mandatory fields:
    <?
    
    if ($mandatory_fields)
    {
    print "You have forgotten to fill in some mandatory fields:";
    reset($mandatory_fields);
    while ( list ( $index,$field_name) = each ( $mandatory_fields ))
    {
    print ("<br>$field_name");
    }
    }
    ?>



NOTE: In previous versions, two hidden form fields were used to indicate the id of the article
to which the user was redirected in case of a successful new registration or registration change.
To ensure compatibility with such versions, fields success_reg and success_change
may still be used, provided that url_ok and url_change are empty.

Previous Next