Using Custom Elements with Telerik UI for PHP Form

1 Answer 330 Views
Form
CP
Top achievements
Rank 1
CP asked on 13 Nov 2021, 01:33 AM

Hi Folks,

The Telerik UI for PHP works well to allow for using standard elements within the library. I'm able to create a standard Telerik form and field as below for example.

$username = new \Kendo\UI\FormItem();
$username->label("Username")
	->field("Username")
	->validation(array("required" => true));

$form = new \Kendo\UI\Form("form");
$form->orientation("vertical")
	->addItem($username);

Is it possible however to add a custom HTML element to a form, such as the markup for a Google Sign In button for instance? (Maybe something like the below).

$googleButton = new \Kendo\UI\HtmlItem();
$googleButton->content("<div>[code for Google button]</div>");

$form = new \Kendo\UI\Form("form");
$form->orientation("vertical")
	->addItem($googleButton);

Thanks,

CP.

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 17 Nov 2021, 10:59 AM

Hello Carey,

I would suggest you take a look at the following thread from our Forum where a similar issue is discussed:

- https://www.telerik.com/forums/customer-editor

Please try the suggested approaches and let me know in case you have additional questions on the matter.

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

CP
Top achievements
Rank 1
commented on 24 Nov 2021, 09:04 PM

Hi Neil,

Thanks for your feedback. I had a look at the forum thread you mentioned, as well as the documentation for items.editor and buttonsTemplate; however, I'm unclear as to how I'd apply either in my situation.

The items.editor seems to be specifically aimed at creating a custom input field, while buttonsTemplate seems to be about creating custom form buttons in sequence. Maybe there's something I'm not getting, but what I'm trying to achieve, is adding a completely custom HTML element to the form, in a custom position.

Please let me know if there's something I'm missing.

Thanks,

CP.

Neli
Telerik team
commented on 29 Nov 2021, 12:55 PM

Hi Carey,

I am afraid I could not suggest a different approach for adding a custom button to the Kendo Form. You could add a custom button either through buttonsTemplate or as a custom editor. In order to demonstrate creating a button in editor function, I have prepared a Dojo where a button is created in the items.editor.

You could log your idea in our official Feedback Portal, describing in detail the desired result. Depending on the popularity the issue gain in the community, it could be considered for implementation in a future release.

Regards,

Neli

CP
Top achievements
Rank 1
commented on 29 Nov 2021, 03:47 PM

Hi Neil,

Thanks for the Dojo. I was actually able to modify what you sent for my needs, so the custom editor function does in-fact work. Thanks a lot!

Regards,

CP.

Tags
Form
Asked by
CP
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or