Sitecore iframe field type basics

A few days ago I implemented a custom field which should have 2 dropdowns which are depending on each other (here you can find the whole implementation, in this example I will just show you a simple text field).

So I checked all possible solutions and I decided to use the Iframe type for that. This is a default field provided by Sitecore. So in the source input on the template you need to provide the url for your iframe. In my case it will be a Controller:

Capture

To make this path work I need to map this route:

Let’s create our Controller and View:

As you can see in the View it contains 2 important JS references, they are doing the dirty job:

At the end the result is this:

Capture

Conclusion

After the base functions are created easy to use this because you have the whole control of your field (design, behaviour). I would suggest this solution if you need a complex field (like you have more fields depend on each other). So I already mentioned at the beginning you can find here a more complex field resolved by iframe: https://github.com/ALLWIN-Informatics/Allwin.Sitecore.Modules.LiveList

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s