Page 1 of 1

how can i get field name on Custom View/Edit Tag

Posted: Sat Mar 31, 2018 6:50 am
by shahabksh

hi

i use Custom View tag in code part

who can i get currect fild name

@{
var return = CurrentPage.{{{name}}}.CurrentValue;
}
@
return

it's return x_CustomerName but this fild name is only CustomerName


Re: how can i get fild name on Custom Edit Tag

Posted: Sat Mar 31, 2018 9:47 am
by Webmaster

{{{name}}} stands for the id or name attribute of the HTML element of the field, which is "x_<fieldname>". To output the field value only just use {{{value}}}. There is no tag for outputting the field name. Read "Field Setup" -> "Custom Edit Tag" in the help file for details.


Re: how can i get fild name on Custom Edit Tag

Posted: Sun Apr 01, 2018 5:35 am
by shahabksh

tanx for your help
i replace

var _return = CurrentPage.{{{name}}}.CurrentValue;
with
var _return = {{{value}}} + "my_string";

not how i can Set output to save fild in database (i use Custom Edit Tag)?


Re: how can i get field name on Custom Edit Tag

Posted: Sun Apr 01, 2018 9:24 am
by Webmaster

As explained in the help file, {{{value}}} is "the CurrentValue of the field object. It will converted to @<page>.<field>.CurrentValue. Note that it includes the @ tags, use it in HTML only, do not use it in C# code". So you code (in C#) will NOT work.

Since it is a Custom Edit Tag, your custom tag should provide a HTML form input element (which name should be {{{name}}}) in HTML so you field value can be submitted and saved.

Read "Field Setup" -> "Custom Edit Tag" in the help file carefully, read the examples, try to understand how it works first.