We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to use JS components in PHP?

Introduction

Using Syncfusion Essential JavaScript components in a PHP application is simple. It is similar like using the components in a normal HTML page. This section explains you about how to use JS components in a simple PHP form with validation.

Refer the script and theme files in <head> section:

Refer to the necessary scripts and theme files required by the Syncfusion EJ components in the <head> section as follows.

HTML

 

In the above code example, scripts refers to the folder that contains the script files. Make sure that the above mentioned script files are loaded properly.

You can also use the CDN links, instead of referring the scripts and theme files locally. Refer to the following code example.

HTML

 

You can refer to the following link to know more about the necessary scripts files and dependencies script files.

http://help.syncfusion.com/ug/js/documents/dependencies.htm

Declare the elements in the <body> section

Specify the necessary tag in the <body> section that you are going to convert as EJ components. In this form validation example, the following three EJ components are used

  • Numeric textbox, in which user needs to specify the age.
  • RichTextEditor(RTE) is used to specify the comments by the user.
  • Button is used to submit the form.

Refer to the following code example to render the form elements in the page.

HTML

 

Initialize the components in the <script> section

The EJ components are initialized in the Script section as follows. During initialization, you can also specify the necessary API’s, and bind events for the components.

JavaScript

 

Refer to the following code example for the validation is written in PHP.

PHP

 

Output

You can download the sample from the following location.

http://www.syncfusion.com/downloads/support/directtrac/133166/index-397695855.zip

You can refer to the following common user guide for JavaScript to know more about getting started with the components. Under each components, Concepts and features section is provided that explains about the features of the particular component.

http://help.syncfusion.com/web

You can also refer to the following class reference link for JavaScript that provides all the properties, methods and events supported by each component.

http://help.syncfusion.com/cr/js

Article ID: Published Date: Last Revised Date: Platform: Control: Product Version:
3426 01/27/2015 01/30/2015 JavaScript General 12.1.0.43
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.