Inserting links using a template (YouTube link, patternString)

The patternString field type allows you to enter a certain field in a certain format (for example, a link to Youtube) and output a markup with the code from this field in the form of some markup in a certain form (for Youtube, this is an iframe with a YoutubeID). 

An example can be viewed here below - All fields of the form

A person inserts a link to YouTube and gets a visualization. The platform extracts a certain string and the initial input string from the template and substitutes it in a special markup. 

How to implement it: 

1. Specifying the type Line by template (patternString)

2. In getItem, we specify the initial value in the form "Source line||value", where Value is, for example, this is youtubeID

We also specify options_ for the field in which we specify an array of templates (regular expressions) and   & nbsp;makeup-markup with the insertion of the variable {value}, which will be replaced by value from the input line.

-- GetItem for form
  --'||HTNlwdYBef4' s50,
  '||HTNlwdYBef4' s50,
  '{"templates": [".*?v=(.*)$", "*)$"], "makeup": "" }' options_s50


  • the example shows 2 url templates for Youtube links. 
  • if several templates are suitable, the last suitable template will be applied. 
  • in templates, some characters are replaced with their html counterparts (for example, & is replaced with &), keep this feature in mind

3. In saveItem, we get this field in the form of "Source string||value", which can be parsed using the function dbo.str_splitPart

-- saveItem
set @inputString = dbo.splitPart(@val, '||', 1)
set @elementID = dbo.splitPart(@val, '||', 2)

Thus, it is possible to process various data in a certain format and through templates to visualize them immediately on the form in the form of a certain markup.

Falcon Space is a functional web development platform on a narrow stack MS SQL/Bootstrap. Falcon Space Gettting started

SQL-tool for creating personal accounts on the site

The essence of the approach and the history of the creation of Falcon Space
Web platform for creating personal accounts

Falcon Space Platform

This is a reduction in the cost of ownership

at the expense of fewer people to support

This is a quick change

while using the program

This is a modern interface

full adaptation for mobile devices

MS SQL web applications. Affiliate program for developers and web studios

You can develop on your own or collaborate with us on Falcon Space web development using only SQL and HTML.
See examples with SQL code
Platform documentation
Working on MS SQL Server