Placeholder ( _param ; _text ) ( )

Function stats

Average user rating
516
389
9999
Support
FileMaker 10.0 +
Date posted
03 November 2015
Version
1
Recursive function
No

Author Info
 Kaostika Studios

1 functions

Average Rating None

author_avatar



 

Function overview

Prototype

Placeholder ( _param ; _text )  ( _param;   _text )


Parameters

_param  


_text  


Description

Tags:  Layout   interface  

Use FieldName with TitleText or Field Comments to put in placeholder Text.

The _Param is default text like "Please Enter" or what ever you put in the CF.

The _text should be self. I will be adding more to this function. This is the official home so far.

Examples

Sample input

Placeholder ( 1 ; self ) (field name is FirstName and no field comment)

Placeholder ( "" ; self ) (fieldname is FirstName and field comment is "Your First Name Please")


Sample output

"Please Enter First Name"
"Your First Name Please"

 

Function code

// Created by Oreste Schiavone of Kaostika Studios. Thanks to Fabrice. I used his text.trim CF in this. Also thanks to Beeswax. For their Placeholder demo found here https://blog.beezwax.net/2015/05/12/filemaker-14-field-placeholder-text/

// You can make the _param a separate CF if you want to easily edit it or reference a table or global variable etc. Just make sure you put paragraph return so it gets the right value.

// It will always use the prefix so be aware of that.

// This version uses the field comments in each field. It will use the field Name with TitleCase and add a space. If you have a naming convention like zz_FirstName. you can just substitute those out.


Let (
[

$list ="Please Enter¶Enter";


$prefix = If (IsEmpty (_param); "" ; GetValue ( $list ; _param ));

$text = GetFieldName ( _text ) ;


$comment = FieldComment ( "" ; GetFieldName ( _text ) );


$field =

Substitute (( Middle ( $text ; Position ( $text ; "::" ; 1 ; 1 )+2 ; Length ( $text )) ) ;
[ "Q" ; " Q" ] ;
[ "W" ; " W" ] ;
[ "E" ; " E" ] ;
[ "R" ; " R" ] ;
[ "T" ; " T" ] ;
[ "Y" ; " Y" ] ;
[ "U" ; " U" ] ;
[ "I" ; " I" ] ;
[ "O" ; " O" ] ;
[ "P" ; " P" ] ;
[ "A" ; " A" ] ;
[ "S" ; " S" ] ;
[ "D" ; " D" ] ;
[ "F" ; " F" ] ;
[ "G" ; " G" ] ;
[ "H" ; " H" ] ;
[ "J" ; " J" ] ;
[ "K" ; " K" ] ;
[ "L" ; " L" ] ;
[ "Z" ; " Z" ] ;
[ "X" ; " X" ] ;
[ "C" ; " C" ] ;
[ "V" ; " V" ] ;
[ "B" ; " B" ] ;
[ "N" ; " N" ] ;
[ "M" ; " M" ] ;
[ "P" ; " P" ] );

$result = $prefix & If (not IsEmpty ( $comment) ; $comment; $field)

];



MiddleWords ( $result ; 1 ; Length ($result ))
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/389

    Prototype: Placeholder ( _param ; _text )( _param; _text )
    Function Author: Kaostika Studios (http://www.fmfunctions.com/mid/516)
    Last updated: 03 November 2015
    Version: 1

*/
// ===================================

 

Comments

Lee
05 November 2015



Do you have a demo file of this CF that I can get, Although FMPA has a Placeholder function, I would like to see what I’m doing wrong in my setup.

fmforums.com has a new topic area for member submissions here http://fmforums.com/cf/ and you could post a demo file of the function there.
  General comment
Kaostika Studios
05 November 2015



https://www.dropbox.com/s/ig64chjfl99nc3o/Placeholder.fmp12?dl=0
  General comment
Lee
05 November 2015



Thank you, that made it perfectly clear.

Let me know if you are interested in posting this on www.fmforums.com
  General comment
Kaostika Studios
05 November 2015



You can post it there
  General comment

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (31)
Date  (28)
XML  (26)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (12)
Layout Objects  (11)
Filter  (11)
Design  (10)
Array  (7)