Giter Site home page Giter Site logo

normform's Introduction

NormForm

NormFom is a simple template application for PHP form processing developed for PHP classes in the program Media Technology and Design at the University of Applied Sciences Upper Austria. It is primarily designed for educational purposes (learning object oriented PHP, form processing and templating languages). Use it for "public" applications at your own risk.

NormForm is designed as a single-page form validation and processing system, meaning that once the form is submitted, the page calls itself again and the process starts anew. It provides an abstract class (AbstractNormForm) which implements a standard form display-validate-business logic process along with classes for form parameter management and display.

Installation

The recommended way to use NormForm in your project is through Composer:

composer require fhooe/normform

Alternatively, you can use the NormForm Skeleton project that gives you a fully working example built upon NormForm (including a template file and CSS):

composer create-project fhooe/normform-skeleton path/to/install

Composer will then create a project in the path/to/install directory.

Basic Usage

To use NormForm create a class that inherits from AbstractNormForm and implement the required abstract methods isValid() (used for form validation) and business() (for business logic, once the form has been successfully submitted). Then create an instance of your new class and call the normForm() method to initiate the process (preferrably in a separate file such as index.php).

Contributing

If you'd like to contribute, please refer to CONTRIBUTING for details.

License

NormForm is licensed under the MIT license. See LICENSE for more information.

More Information

normform's People

Contributors

hochleitner avatar martinharrer avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

normform's Issues

Unneccessery left margin for inputs

<div class="InputCombo"> fields have an unnecessary 1em margin in the left and are therefore indented compared to headings and other content.

Prettier results

Should we format the result of the demo form in a more prettier or explanatory way?

We could use the <dfn> or <abbr> tags to highlight what is the key in $_POST and what's the value there, alternatively the title attribute could also suffice for a mouse-over explanation.

More ideas or discussion is welcome.

Dependencies to files outside of project

There are a few files that have dependencies on files that are not part of the normform project.

  • Utilities.class.php uses constants from the imar project (INDEX, ISLOGGEDIN, REGISTER, LOGIN, REDIRECT_FALSE)
  • Templates in basetemplates use Smarty Constants that are assigend in imar.

I suggest moving these files or the affected methods to imar or make them more general.

Language inconsistencies

The contents of the demo file are part German and part English. Setting everything to English is probably best.

Flexbox issue with textarea

The label of the textarea does not stretch vertically, the textarea itself does not take up the full width (as the input fields do).

Scalar type hinting and return type declarations

Since normform is meant to be used as a kind of library, I think it would be a good place to demonstrate scalar type hinting and return type declarations.
If there are no objections, @martinharrer, I'd implement it on the functions and methods in normform.inc.php, TNormform.class.php, utilities.inc.php, and Utilitites.class.php.

Naming convention

Decide on a naming convention:

  • normform.class.php
  • tNormform.class.php
  • other suggestions

Comments welcome!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.