WebForms Core is a revolutionary and new technology created by Elanat in 2024. With WebForms Core technology, you no longer need to use JavaScript and front-end development because this technology allows you to manage all HTML tags in the back-end.
Now you can use this high-level technology in the PHP programming language.
We at Elanat team have successfully tested WebForms Core technology on PHP.
Testing steps
First, download the WebForms class of the PHP programming language from the following link:
https://github.com/elanatframework/Web_forms_classes
Then download the WebFormsJS library from the following link and add it to the head section of the HTML page:
https://github.com/elanatframework/Web_forms
Create PHP file
The following image shows the view of a PHP page. This is the view that is first requested from the browser.
The HTML code of the above image is shown along with the PHP code below.
index.php
<?php
include 'WebForms.php';
if (!empty($_POST['btn_SetBodyValue']))
{
$Name = $_POST['txt_Name'];
$BackgroundColor = $_POST['txt_BackgroundColor'];
$FontSize = (int) $_POST['txt_FontSize'];
$form = new WebForms();
$form->setFontSize('<form>', $FontSize . 'px');
$form->setBackgroundColor('<form>', $BackgroundColor);
$form->setDisabled('(btn_SetBodyValue)', true);
$form->addTag('<form>', 'h3');
$form->setText('<h3>', "Welcome " . $Name . "!");
echo $form->response();
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Using WebForms Core</title>
<script type="text/javascript" src="/script/web-forms.js"></script>
</head>
<body>
<form method="post" action="/" >
<label for="txt_Name">Your Name</label>
<input name="txt_Name" id="txt_Name" type="text" />
<br>
<label for="txt_FontSize">Set Font Size</label>
<input name="txt_FontSize" id="txt_FontSize" type="number" value="16" min="10" max="36" />
<br>
<label for="txt_BackgroundColor">Set Background Color</label>
<input name="txt_BackgroundColor" id="txt_BackgroundColor" type="text" />
<br>
<input name="btn_SetBodyValue" type="submit" value="Click to send data" />
</form>
<body>
</html>
As you can see, the WebFormsJS script has been added in the header section of the View file above.
In the upper part of the View file, it is first checked whether the submit button has been clicked or not, if it has been clicked, an instance of the WebForms class is created, then the WebForms methods are called, and then the response method is printed on the screen, and other parts Views are not displayed. Please note that if the submit button is not clicked (initial request), the view page will be displayed completely for the requester.
The following image shows the view of the PHP page after clicking on the button.
Note: Please note that you need to add the PHP WebForms class next to the index.php file and also place the WebFormsJS library in the script directory and then add this directory next to the index.php file.
WebForms Core is a faithful HTML technology. In this example, it is clear that the data is sent via the POST method. After clicking on the button, the following data is sent based on the HTTP protocol.
Request
txt_BackgroundColor=mediumpurple&txt_FontSize=32&txt_Name=Adriano&btn_SetBodyValue=Click to send data
The following code is also the server response that is sent to the client via the HTTP protocol. The response codes are generated by the WebForms class on the server and are interpreted (rendered) by WebFormsJS and then applied to the HTML page.
Response
[web-forms]
fs<form>=32px
bc<form>=mediumpurple
sd(btn_SetBodyValue)=1
nt<form>=h3
st<h3>=Welcome Adriano!
Note: In this simple example, we send data from the client to the server and the server responds. Please note that WebForms Core technology has a high level of performance and by using its various capabilities you can experience more performance than JavaScript without having to send data to the server.
WebForms Core Advantages
Backend Management of HTML Tags: With WebForms Core, you can manage HTML tags directly from the backend, which simplifies the development process. This eliminates the need to write JavaScript for front-end interactions.
Simplified Development: As WebForms Core handles both the backend and frontend within PHP, it reduces the complexity of managing different technologies. This can make the development process more straightforward and less error-prone.
Reduced Dependency on JavaScript: By minimizing the need for JavaScript, WebForms Core reduces the risk of common front-end issues and can lead to better performance and security. This is especially beneficial for developers who are more comfortable with backend languages like PHP.
Improved Performance: As the example illustrates, WebForms Core can handle data submission and server responses efficiently. By managing form interactions server-side, it can potentially offer better performance compared to traditional client-side rendering.
Consistent HTML Rendering: Since the HTML is managed server-side, you can ensure a consistent rendering of HTML elements across different browsers and devices. This can simplify testing and maintenance.
Ease of Integration: For teams already using PHP, integrating WebForms Core can be seamless, as it leverages existing knowledge of PHP and its ecosystem.
Simplified State Management: Handling state on the server can simplify the flow of data and reduce issues related to client-side state management, such as synchronization problems and the complexities of managing component lifecycles in frameworks like React or Vue.
PHP Backend Code: The server-side code manages form submissions, updates HTML elements, and sends responses back to the client.
Ease of Learning: For developers already familiar with PHP, WebForms Core may have a shorter learning curve than front-end frameworks, which often require knowledge of JavaScript, frameworks' specific syntaxes, and front-end tooling.
Immediate Feedback: The server-side response and rendering model allows for direct manipulation of the DOM based on user input, which can provide immediate feedback without the need for extensive client-side scripting.
Reduced Client-Side Complexity: By managing everything on the server, the client-side codebase can be significantly simplified, leading to potentially fewer bugs and easier maintenance.
Robustness and Security: By limiting the amount of client-side code, there may be fewer vulnerabilities to common JavaScript attacks (e.g., XSS), as the input is managed and validated on the server-side.
JavaScript Library: The WebFormsJS library interprets server responses and updates the HTML accordingly.
Consolidated Architecture: Having a single point of management (the server) for UI and logic can lead to a more cohesive architecture, making it easier to maintain and extend.
No Need for APIs Unlike front-end frameworks that necessitate the creation of multiple server-side APIs to handle requests, WebForms Core manages all interactions on the server side without requiring separate API endpoints. This reduces development overhead and simplifies data handling.
Single Server Request: Front-end frameworks typically require multiple requests to the server for dynamic content updates. In contrast, WebForms Core only makes a single request, after which it processes commands on the client side, minimizing server load and improving response times.
Lower Server Pressure: Since WebForms Core generates commands that are executed client-side without heavy reliance on JavaScript, it alleviates pressure on the server compared to traditional frameworks that often require constant communication with the server for updates.
Automatic Compatibility Management: Updates in front-end frameworks can lead to compatibility issues and increased maintenance challenges. WebForms Core automatically manages compatibility between its server-side structure and client-side scripts, reducing maintenance burdens associated with framework updates.
HTML-Faithful Approach: WebForms Core maintains a pure HTML structure, minimizing extraneous data sent to the server and ensuring that the application remains lightweight and efficient. This contrasts with many front-end frameworks that can bloat applications with unnecessary complexity.
Advantages of WebForms core compared to similar technologies:
- It does not depend on any back-end or front-end framework.
- It is automatic and does not require markup in HTML tags.
- It performs multiple actions in a single response.
- The data sent and received between the server and the client is very lightweight.
- It is very easy to set up.
WebForms Core technology is available in all of the following programming languages (or frameworks):
- C# (.Net)
- Elixir
- GO
- JAVA
- NodeJS
- PHP
- Python
- R
- Ruby
- Rust
- Swift
Conclusion
WebForms Core offers a modern approach to web development by focusing on server-side management of HTML elements, which simplifies the development process, enhances performance, ensures compatibility, and reduces errors. This makes it an appealing alternative for developers looking to streamline their web applications without diving deep into JavaScript or complex front-end frameworks.
Top comments (0)