JHizzle
JHizzle

Reputation: 21

Kentico Forms, Default Values and Macros

A client is asking that their field be defaulting to the querystring parameter passed to it. According to the documentation, it should simply be a case of {? querystringnamehere ?} in the default value field but this is apparently not resolving. Has anyone used this before and am I missing a step?

Additional info: This is using version 11.

I based my information on: https://docs.xperience.io/k11/managing-website-content/forms/using-macros-with-forms

Upvotes: 2

Views: 538

Answers (3)

jurajo
jurajo

Reputation: 995

You need to use the small black arrow next to the label to enter a macro expression. Otherwise it is considered as text. Also make sure you sanitize the query string against SQLi https://www.screencast.com/t/wMxZdNUFM7U

Upvotes: 0

liamgold
liamgold

Reputation: 283

If you are using Kentico 12 MVC, I posted a blog post showing how to add data attributes to your Kentico Form, and embed JS to handle the default values. https://www.goldfinch.me/blog/using-default-values-in-kentico-mvc-forms/

Upvotes: 1

Johnny
Johnny

Reputation: 454

I believe you are using Kentico MVC, which version you're using now? If you are using Kentico MVC, I suggest you to include another JS script to handle the default value, I spend sometime with the Kentico Form Macro (https://docs.xperience.io/k12sp/managing-website-content/forms/using-macros-with-forms) but there was no luck

Upvotes: 0

Related Questions