Create forms dynamically

1 Answer 36 Views
Form
Rob
Top achievements
Rank 1
Veteran
Rob asked on 27 May 2021, 02:41 AM

Hi guys

I am loosely trying to recreate this sample   editing nodes using a form, but using the kendo form as I like the ability to add validation etc

The first time I create the form it works.. but if I try to update it ( e,g select another node) , the values are not displayed. 

dojo

The above link hopefully explains what I mean.. I try destroying the form and then remaking it ( resetting the fields to the new values) , but I never get to see the new values. ( click on the open form button a 2nd time)

Any pointers would be greatly appreciated!

Many thanks

Rob

1 Answer, 1 is accepted

Sort by
0
Accepted
Neli
Telerik team
answered on 31 May 2021, 01:43 PM

Hello Rob,

Regarding recreating the Form I would suggest you removing the form element instead of using the empty() method. As it is mentioned in our documentation - the empty method may not always work as expected. I have modified the Dojo example by removing the form element and appending it again. 

However, instead of recreating the Fоrm I would suggest you use either the setOptions method or you could use also the approach described in the Knowledge base article linked here for programmatically setting the form fields.

Here you will find a Dojo example where the values in the Form are set by using the setOptions method.

I hope this helps.

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Rob
Top achievements
Rank 1
Veteran
commented on 31 May 2021, 09:39 PM

This is awesome, thank you Neli!
I had tried setOptions wasn't working for me either, so I will look at your example..
I have different 'forms' for different "Node types" , which is why I was looking at removing and creating the form each time with the correct form for that Node.
Thankyou again for your support , it makes a huge difference,
Tags
Form
Asked by
Rob
Top achievements
Rank 1
Veteran
Answers by
Neli
Telerik team
Share this question
or