MVC widget textbox validation

innovix solutions asked on February 3, 2019 09:26

We have developed a widget to upload a image with image caption. I cannot seems to find validation for entry field such as mandatory in MVC widget as well as a way to limit maximum can upload only 2 photos etc..

https://docs.kentico.com/k12/managing-website-content/using-widgets-in-mvc

Recent Answers


Ilesh Mistry answered on February 4, 2019 08:05

One option is to look at the way you’ve created the MVC Widget.

As there are different ways to do this and using front end technologies.

I would think if you want to limit something and provide validation. Have you tried doing this using JavaScript? Client side validation can work for these scenarios. Not sure if this is an option for you?

0 votesVote for this answer Mark as a Correct answer

innovix solutions answered on February 4, 2019 09:11

MVC widget development is quite troublesome. While portal engine is easy for developer and now developer need to do everything with MVC approach. Am i right?

0 votesVote for this answer Mark as a Correct answer

Ilesh Mistry answered on February 4, 2019 10:11

Yes, MVC development requires widget development to be completed fully and not provided by Kentico. Unless you utilise the widgets from Dancing Goat website.

Portal Engine did provide easier options to create widgets, but I feel this is because it was around for a long time. I feel MVC will also be like this over time. We all would need to adjust and adapt towards it.

I feel MVC allows the options to be flexible enough for people to create their own widgets/components to their own requirements. It also gives you the ability to standardise your development as a company, so there are benefits to this. Depending on the skill set within your company, you can create the widgets functionality in a front end technology that suits you e.g. VueJs or ReactJS or jQuery etc...

There are a lot of benefits going forward using this approach.

0 votesVote for this answer Mark as a Correct answer

innovix solutions answered on February 4, 2019 10:25 (last edited on February 4, 2019 10:28)

yes. i think so too but we are using CMS but developer need to put more efforts in time and energy. So client will be complaining to us.

Dancing goat sample is just a basic one and not suit to development a big website. Our requirements are like need to upload images for both desktop and mobile. Need to be able to sort just drag and drop. Content need to pick from content tree etc. So those task will be painful for developers.

0 votesVote for this answer Mark as a Correct answer

Ilesh Mistry answered on February 4, 2019 11:11

I do agree with you and it will take a longer to create the widgets in MVC. The transistion process is important to factor into the build process. I believe this is something that might take some time. And managing client expectations is important before and during this process.

I also agree and I think Kentico would also agree too, the Dancing Goat site is a sample and teaser to how some simple widgets could be implemented. It provides you with a stepping stone to build them yourself.

Your examples can be achieved and will require some thought process behind it. The images upload for desktop and mobile can be achieved with potential direct upload examples online and then tie into the code behind. I'm not sure what you mean, without more detail, about the sorting and drag and drop requirements. Picking content from the content tree is possible, by extending what we would normally use as a form control (on the form tab) but build this ourselves using Kentico API and having a path selector in it. And then you can configure the widget configuration property to allow the content editor to pick this up.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.