online form Macro

Gideon Gontor asked on November 29, 2018 14:16

I cloned on line form webpart and add additional fields, how can I pass the value of the webpart property to a form field using macro

Recent Answers


Brenden Kehren answered on November 29, 2018 14:43

Make sure you have the properties defined with the get and set values in the web part code. Then go to the user interface and define those properties in the web part definition. Then when you add the web part to a page template that property will be available and you can send it via a macro.

0 votesVote for this answer Mark as a Correct answer

Gideon Gontor answered on November 29, 2018 16:06

Thanks, for your kind response, I updated the online form webpart code with get and set value Then add the following in the form property default field {% WebPart.GetValue("FormWebpartID","PropertyName") #%} I didn't not get the value in the form field as expected, iam missing any step?

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on November 29, 2018 17:57

You should just call {%PropertyName%}. Default properties are working fine, here is an example: Image Text

About custom ones I am not sure but try them. There was a discussion about this before

0 votesVote for this answer Mark as a Correct answer

Gideon Gontor answered on November 29, 2018 18:45

Thanks, your example works except that iam trying to use the webpart property value in a form field in using macro. I don't mind if there are other options

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on November 29, 2018 18:51

If by the form field you mean the form tab for content entry, then simply use the form field name. For instance you have a page type called Articles and a field on that page type called ArticleImageUrl. To get that ArticleImageUrl value (can only be done when you're selected on that page) use the following macro:

{%ArticleImageUrl%}

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on November 29, 2018 18:54

Are your trying to get value of a web part on a document form tab? Normally you do the opposite, i.e. you set a web part value based on current document, i.e. {%CurrentDocument.GetValue("DocumentFieldName")%} Your document properties define the look of your document(i.e. template with web parts) not vice versa.

0 votesVote for this answer Mark as a Correct answer

Gideon Gontor answered on November 30, 2018 10:19

Thanks for all your help

This is what I want to achieve

We have four identical forms on our present website which we are migrating to kentico(SharePoint) Each form have an editable field that an editor adds a reference to which is not visible to external user.

I compare this forms to an alternative form in kentico. I created the alternative forms in kentico, so that whenever he adds one of the forms to the page he can edit the form webpart properties and add the reference field, the value is passed into a field on the alternate form before saving the form.

0 votesVote for this answer Mark as a Correct answer

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