Alpha DevCon 2018
Results 1 to 5 of 5

Thread: Field Templates

  1. #1
    Alpha Software Employee Beta Spark's Avatar
    Real Name
    Sarah Mitchell
    Join Date
    Jul 2015
    Posts
    391

    Default Field Templates

    HTML for fields in the FormView are rendered based on the field's template. Templates are defined using Alpha Anywhere's client-side templating syntax. If you've worked with the list control, you may be familiar with client-side templating. If not, hang on! We have some resources for you later on in this post.

    Templates in the FormView can be specified at the Form level (the 'system' template and 'named' templates) or defined for individual fields in their template property. Client-side templating directives, such as conditional statements, can be used when defining templates allowing you to create beautiful, robust interfaces.

    Understanding Field Templates



    Video Link: http://www.alphasoftware.com/video-library/?v=4914

    View the rest of the Template Videos in the Video Library:


    Prerequisite Knowledge Base
    If you've never heard of the FormView control or don't know what it is, check out our Introduction to the FormView Control post.

    While you're checking out that thread, don't forget to brush up on your Client-side Templating :
    • Client-side Template Tutorial: A step-by-step tutorial on merging JSON data into a client-side template
    • The Template Tester: A tutorial on client-side template syntax and how using the Template Tester will help takes the guess work out of creating client-side templates.
    • Alpha Anywhere Official Release Notes: These notes detail features and fixes made to Alpha Anywhere since its initial release. The release notes often contain a wealth of useful information and examples. Use your browser to search the release notes for "client-side templates" to find a wealth of information and examples.


    Who has created field templates in their applications? Share your field templates and questions in this thread!
    Last edited by Beta Spark; 08-31-2015 at 10:11 AM.
    Sarah Mitchell

    Looking for answers? Try our documentation.
    If you can't find something, let us know!

  2. #2
    Member
    Real Name
    Bill Hess
    Join Date
    Jul 2014
    Posts
    17

    Default Re: Field Templates

    I need some help with the field template. I am trying to create a Field Template with a conditional that uses the Field on the Form View. If include the field as {*field} it freezes.
    for example:<div class="checklisttextitem {[temp].state.classes[{*fieldname}]}">
    {*if {*field}=="Fail"}
    do something
    {*else}
    do something else
    {*endif}
    <span class="checklisttextitemtext">{*field}</span>{*fieldLabel}
    </div>

  3. #3
    Alpha Software Employee Beta Spark's Avatar
    Real Name
    Sarah Mitchell
    Join Date
    Jul 2015
    Posts
    391

    Default Re: Field Templates

    Quote Originally Posted by billdhess View Post
    I need some help with the field template. I am trying to create a Field Template with a conditional that uses the Field on the Form View. If include the field as {*field} it freezes.
    Hi Bill,

    Try using the {*fieldName} placeholder instead:

    Code:
    <div class="checklisttextitem {[temp].state.classes[{*fieldname}]}">
    {*if {*fieldName}=="Fail"}
    do something
    {*else}
    do something else
    {*endif}
    <span class="checklisttextitemtext">{*field}</span>{*fieldLabel}
    </div>
    Sarah Mitchell

    Looking for answers? Try our documentation.
    If you can't find something, let us know!

  4. #4
    Member
    Real Name
    Bill Hess
    Join Date
    Jul 2014
    Posts
    17

    Default Re: Field Templates

    That did the trick! I looked at the generated code and that makes sense.
    Thanks,
    BH

  5. #5
    Member
    Real Name
    Bill Hess
    Join Date
    Jul 2014
    Posts
    17

    Default Re: Field Templates

    OK, Since I am red/green color blind, the demo didn't do it for me because I couldn't tell the difference between the red and green highlights for pass/fail.
    So I used Icons to indicate Pass/Fail. I attached the file (TabletForm_Sample_App_VHess.a5wcmp) if you want to see what I mean.
    BH
    Attached Files Attached Files

Similar Threads

  1. Can you insert masks or templates in search field?
    By EF50 in forum Application Server Version 9 - Web/Browser Applications
    Replies: 4
    Last Post: 09-23-2013, 03:24 PM
  2. Where did the supercontrol templates go?
    By jopowers68 in forum Alpha Five Version 9 - Desktop Applications
    Replies: 9
    Last Post: 06-20-2009, 05:11 PM
  3. Label templates
    By Ales in forum Alpha Five Version 8
    Replies: 1
    Last Post: 12-09-2008, 04:06 PM
  4. Templates
    By Paul Miller in forum Alpha Five Version 5
    Replies: 3
    Last Post: 07-30-2004, 12:37 PM
  5. Templates
    By James Peterson in forum Alpha Five Version 5
    Replies: 2
    Last Post: 01-09-2003, 09:22 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •