How to Write a Transformation for an Alternative Form

Mike Bilz asked on June 28, 2017 21:15

Hello Kentico Team,

I have an Alternative Form connected to a User Contribution Web Part. This alternative form has additional fields which do not appear in the standard form.

How do I access these additional fields within a transformation?

When I write an Eval like <%# Eval("MyCustomField", true) %> it returns nothing.

Is there a special declaration or piece of code I need to add? or is this Alternative Form data not actually stored anywhere?

Thanks.

-mike

Correct Answer

Brenden Kehren answered on June 28, 2017 22:16

Understood now Mike. I thought you were using an actual Form within your page type.

For this, if your alternative form has a field in which the actual page type does not, that data is not being stored in the database. So what you need to do is create that field in the main page type definition and then show it on your alternative form(s) as needed.

See the screenshot below. I created an alternative form for the Articles page type and added a new field and it has this at the top of the new field "This field will be created without database representation". So go back and add it to the page type definition and not the alternative form.

Image Text

0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on June 28, 2017 21:25

Sounds like you might be confusing 2 different things:

  1. Alternative forms - used for data management i.e.: insert/edit of structured data
  2. Transformations - used for displaying data from structured content

If you have a form being displayed in a transformation you still don't need to alter a transformation, you'd need to deal with your alternative form or form definition of that object (page type, class, form, etc.).

0 votesVote for this answer Mark as a Correct answer

Mike Bilz answered on June 28, 2017 21:46

Hi Brenden, I may not have been entirely clear in my issue.

I have created an Alternative Form for the Event page type, which has additional fields not present in the main form.

I am creating a transformation to display Event pages, and would like to include the content of these additional fields in that transformation for events created with the Alternative Form.

How do I access the data from these fields?

Thanks.

-mike

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on June 28, 2017 21:59

First you'd have to have that event tied to a form somehow. Then in the transformation you'd need to perform a lookup of that form data based on that field value in the event page type. The downside of this is when you perform that API query, it will get all the form submissions and not a single one. So for that given event, you will display all the submissions for that event.

If you have that one form hooked up to multiple events, you will get all the form submissions for all the events. So not really an ideal situation; you'd want to have a new form for every event. You also need to think about performance. If you're only doing this for a single event it's probably not too bad but if you're loading a list of events and every event has to go out and get form submissions, it could cause a lot of problems.

Here are the API examples for getting online forms and their data.

0 votesVote for this answer Mark as a Correct answer

Mike Bilz answered on June 28, 2017 22:09

Hi Brenden, I think we are still talking past each other.

I have a Contribution List web part, which people can use to create Event page types, using a special Alternative Form (Code Name: PublicSubmission).

The issue I am having is that the Alternative Form has additional fields which are not present in the standard form used to create a new Event.

How do I access these additional fields in my Event page transformation?

Sorry for any confusion. Thanks.

-mike

0 votesVote for this answer Mark as a Correct answer

Zachary Perry answered on June 28, 2017 22:10

You created fields in the alternative form that aren't actual fields on the page type? I am not 100% sure those field values are actually saved anywhere. I could be wrong though.

0 votesVote for this answer Mark as a Correct answer

Mike Bilz answered on June 29, 2017 01:44

Thanks everyone. I've got it all sorted now, and everything is working well.

Glad to know it was just a silly mistake on my part.

0 votesVote for this answer Mark as a Correct answer

Ellie Malan answered on June 29, 2017 14:40

This hypothesis proposes that species remain generally unaltered for drawn out stretches of time Custom Essay Help, (apparently when the earth is moderately steady). It doesn't supplant advancement through normal determination, yet is an adjusting hypothesis.

0 votesVote for this answer Mark as a Correct answer

Florence Willburn answered on July 15, 2017 07:18

It is completely related to programming and its logic.I am a writer and it is new area for me. It is better for you to seek online help to get correct solution for this question. Our company, term paper writing service reviews offer trusted reviews about site and hope it will help for you.

0 votesVote for this answer Mark as a Correct answer

Cheryl Faye answered on July 17, 2017 08:33

This speculation recommends that species remain for the most part unaltered for drawn out extends of time .You made fields in the option shape that aren't genuine fields on the page sort? I am not 100% beyond any doubt those field esteems are really Online Essay Help | essayChamp spared anyplace. I could not be right however. It is totally identified with programming and its logic. I am an author and it is new range for me. It is better for you to look for online help to get right answer for this inquiry.

0 votesVote for this answer Mark as a Correct answer

Elise Ward answered on July 17, 2017 12:52

Programming is a very interesting job but it is hard to learn. You have to be creative if you are doing aprogramming. I am a writer at Essays Writing Service UKand programming is new era for me.

0 votesVote for this answer Mark as a Correct answer

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