This commit is contained in:
265
platform/widget-scripts.html
Normal file
265
platform/widget-scripts.html
Normal file
@ -0,0 +1,265 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Script use cases</title>
|
||||
<meta name="generator" content="Help+Manual" />
|
||||
<meta name="keywords" content="" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="Widgets are a convenient tool for setting up dynamic forms, for instance, if some information needs to be displayed when certain conditions are met." />
|
||||
<meta name="picture" content="" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="Full documentation for BRIX365 platform. Low-code developer guide. User guide. Admin guide. Developer guide." />
|
||||
<meta property="og:url" content="https://brix365.com/en/help" />
|
||||
<meta property="og:image" content="" />
|
||||
<link rel="icon" href="favicon.png" type="image/png" />
|
||||
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="./jquery-ui.min.css" />
|
||||
<link rel="stylesheet" href="default.css" />
|
||||
<link rel="stylesheet" href="./search-yandex.css" />
|
||||
<link rel="stylesheet" href="./article.css" />
|
||||
<link rel="stylesheet" href="./glossary.css" />
|
||||
<link rel="stylesheet" href="./theme.css" />
|
||||
<script type="text/javascript" src="jquery.js"></script>
|
||||
<script type="text/javascript" src="helpman_settings.js"></script>
|
||||
<script type="text/javascript" src="helpman_topicinit.js"></script>
|
||||
|
||||
<script type="text/javascript" src="highlight.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){highlight();});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<script>!function(e,t,c,n,r,a,m){e.ym=e.ym||function(){(e.ym.a=e.ym.a||[]).push(arguments)},e.ym.l=1*new Date;for(var s=0;s<document.scripts.length;s++)if(document.scripts[s].src===n)return;a=t.createElement(c),m=t.getElementsByTagName(c)[0],a.async=1,a.src=n,m.parentNode.insertBefore(a,m)}(window,document,"script","https://mc.yandex.ru/metrika/tag.js"),ym(83179930,"init",{clickmap:!0,trackLinks:!0,accurateTrackBounce:!0,webvisor:!0})</script><noscript><div><img alt=""src=https://mc.yandex.ru/watch/83179930 style=position:absolute;left:-9999px></div></noscript>
|
||||
|
||||
<header class="header elma-365">
|
||||
<div class="container">
|
||||
<a class="header__logo" href="https://brix365.com/en/help">
|
||||
<img src="./logo-en.svg" alt="header logo">
|
||||
</a>
|
||||
<!-- <div class="hero__search-form" id="search-panel">
|
||||
<form class="search-form" onsubmit="ym(83180416,'reachGoal','poisk')">
|
||||
<label class="search-form__label">
|
||||
<span id="reset-search" class="search__icon"></span>
|
||||
<input class="search-form__input" type="text">
|
||||
</label>
|
||||
<input class="search-form__submit" type="submit" value="Submit">
|
||||
</form>
|
||||
</div> -->
|
||||
|
||||
<div class="hero__search-form" id="search-panel"> <form class="search-form"> <label class="search-form__label"> <span id="reset-search" class="search__icon"></span> <input class="search-form__input" type="text"> </label> <input class="search-form__submit" type="submit" value="Submit"> </form> </div>
|
||||
<div class="hero__search">
|
||||
<a href="#" id="search-icon" class="hero__search-icon">
|
||||
<img src="search-icon-white.svg" alt="search string">
|
||||
</a>
|
||||
<a href="#" id="side-menu-icon" class="hero__side-icon">
|
||||
<img src="side_menu.svg" alt="side menu">
|
||||
</a>
|
||||
</div>
|
||||
<div class="header__navi">
|
||||
|
||||
<ul class="header__list"><li><span class="solution-select"><span class="solution-select__selected"></span><svg width="7" height="4" viewBox="0 0 7 4" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L3.5 3.5L6 1" stroke="white" stroke-linecap="round" stroke-linejoin="round"/></svg><ul class="solution-select__list"><li><a class="project-link" href="https://brix365.com/en/help/platform/get-trial.html">Platform</a></li><li><a class="project-link" href="https://brix365.com/en/help/ecm/ecm-functions.html">ECM</a></li><li><a class="project-link" href="https://brix365.com/en/help/crm/crm_overview.html">CRM</a></li><li><a class="project-link" href="https://brix365.com/en/help/service/service-functions.html">Service</a></li><li><a class="project-link" href="https://brix365.com/en/help/projects/projects-functions.html">Projects</a></li><li><a class="project-link" href="https://brix365.com/en/help/business_solutions/-elma365-store.html">Business Solutions</a></li></ul></span></li><li><a href="https://api.brix365.com/en/" target="_blank">API</a></li><li><a href="https://tssdk.brix365.com/" target="_blank">SDK</a></li></ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
|
||||
|
||||
|
||||
|
||||
<main class="main container">
|
||||
|
||||
<aside class="sidebar" id="sidebar">
|
||||
<div class="sidebar__header">
|
||||
<a class="header__logo" href="https://brix365.com/en/help">
|
||||
<img src="./logo-light-en.svg">
|
||||
</a>
|
||||
<span class="sidebar__close elma-365-close" id="close"></span>
|
||||
</div>
|
||||
<div class="sidebar__wrapper" id="side-menu">
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<article class="article" id="article">
|
||||
<div class="article-inner">
|
||||
<div class="content">
|
||||
<header class="article__header">
|
||||
<div class="article__bread" style="display:flex; gap:10px;">
|
||||
<span id="subcategory" class="search-res__item-category search-res__item-category_subcategory subcategory article__badge"></span>
|
||||
|
||||
<div class="topic__breadcrumbs">
|
||||
<p>Low-code designer > <a href="interface_settings.html">Set up interfaces</a> > <a href="client_server_scripts.html">Scripts in widgets</a> / Script use cases</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="topic__title"><h1 class="p_Heading1"><span class="f_Heading1">Script use cases</span></h1>
|
||||
</div>
|
||||
|
||||
</header>
|
||||
<section class="article__content">
|
||||
<div class="scroll-top-inner">
|
||||
<a href="#h1-article" class="scroll-top"></a>
|
||||
</div>
|
||||
<!-- Placeholder for topic body. -->
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 0;"><span style="color: #394149;">Widgets are a convenient tool for setting up <a href="360029574371.html" class="topiclink">dynamic forms</a>, for instance, if some information needs to be displayed when certain conditions are met.</span></p>
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 0;"><span style="color: #394149;">Let’s consider an example of how you can use scripts in widgets. We</span><span style="font-family: Inter;">’ll create a</span><span style="color: #394149;"> page containing a test with several questions. </span><span style="font-family: Inter;">The page will include expanding panels containing the questions, an information box with a warning, and a modal window displaying the test results.</span></p>
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 0;"><img alt="widget-scripts-1" width="616" height="428" style="margin:0;width:616px;height:428px;border:none" src="widget-scripts-1.png"/></p>
|
||||
<h2 class="p_Heading2"><span class="f_Heading2">Create the test questions</span></h2>
|
||||
<p class="p_Normal">First, create multiple choice questions for the test:</p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="1" class="p_Normal">Open the page and go to the <a href="360027211631.html" class="topiclink">interface designer</a>.</li><li value="2" class="p_Normal">On the <span style="font-weight: bold;">Context</span> tab, create a <a href="360009707032.html#category" class="topiclink">Category</a> type variable and set the following parameters:</li></ol>
|
||||
<ul style="list-style-type:disc">
|
||||
<li class="p_Normal"><span style="font-weight: bold;">Display Name</span><span style="font-weight: bold; color: #ff0000;">*</span>. Enter a question to be displayed on the page.</li><li class="p_Normal"><span style="font-weight: bold;">Property Name</span><span style="font-weight: bold; color: #ff0000;">*</span>. Change the automatically generated property name to <code><b>question_1</b></code>.</li><li class="p_Normal"><span style="font-weight: bold;">Type</span><span style="font-weight: bold; color: #ff0000;">*</span>. Select <span style="font-weight: bold;">Category</span> and choose the <span style="font-weight: bold;">Multiple</span> option.</li><li class="p_Normal"><span style="font-weight: bold;">Values</span>. Enter possible answers for the question. Change their codes to <code><b>n1</b></code>, <code><b>n2</b></code>, and <code><b>n3</b></code> and click <span style="font-weight: bold;">Create</span>.</li></ul>
|
||||
<p class="p_Normal" style="margin: 0 0 0 14px;"><img alt="script-use-cases-2" width="588" height="678" style="margin:0;width:588px;height:678px;border:none" src="script-use-cases-2.png"/></p>
|
||||
<ol style="list-style-type:upper-roman" start="3">
|
||||
<li value="3" class="p_Normal">Create a few more questions in the same way.</li></ol>
|
||||
<h2 class="p_Heading2"><span class="f_Heading2">Expanding panel</span></h2>
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 0;"><span style="color: #394149;">Now that you</span><span style="font-family: Inter;">’ve created the test questions, determine how they are going to be shown on the page. Let’s make it so that the</span><span style="color: #394149;"> questions are collapsed by default, but as soon as the user clicks </span><span style="font-weight: bold; color: #394149;">Start Test</span><span style="color: #394149;">,</span><span style="font-weight: bold; color: #394149;"> </span><span style="color: #394149;">the first question panel expands. To do that:</span></p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="1" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">In the <a href="360027211631.html" class="topiclink">interface designer</a>, on the </span><span style="font-weight: bold; color: #394149;">Context</span><span style="color: #394149;"> tab, create a variable of the <a href="360009707032.html#yes-no-switch" class="topiclink">Yes/No switch</a> type called </span><span style="font-weight: bold; color: #394149;">Expand Question 1</span><span style="color: #394149;"> </span><code><b>(expand_question_1)</b></code><span style="color: #394149;">.</span></li><li value="2" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">Add the <a href="panel_with_heading.html" class="topiclink">Panel with header</a> widget to the modeling canvas.</span></li><li value="3" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">In the window that opens, set the following parameters:</span><ul style="list-style-type:disc">
|
||||
<li style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="font-weight: bold; color: #394149;">Title</span><span style="font-weight: bold; color: #ff0000;">*</span><span style="color: #394149;">. Enter the panel</span><span style="font-family: Inter;">’s name, </span><span style="font-family: Inter; font-weight: bold;">Question 1</span><span style="font-family: Inter;">.</span></li><li style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="font-weight: bold; color: #394149;">Collapsible</span><span style="color: #394149;">. Select </span><span style="font-weight: bold; color: #394149;">Yes</span><span style="color: #394149;">.</span></li><li style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="font-weight: bold; color: #394149;">Expanded</span><span style="color: #394149;">. Specify the </span><span style="font-weight: bold; color: #394149;">Expand Question 1</span><span style="color: #394149;"> variable that you created in step 1. With this variable in the condition, the panel will expand when the user clicks the button that is going to be added to the page.</span></li></ul></li></ol>
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 14px;"><img alt="widget-scripts-2" width="580" height="364" style="margin:0;width:580px;height:364px;border:none" src="widget-scripts-2.png"/></p>
|
||||
<ol style="list-style-type:upper-roman" start="4">
|
||||
<li value="4" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">Click </span><span style="font-weight: bold; color: #394149;">Save</span><span style="color: #394149;">.</span></li><li value="5" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">Add the <a href="button_widget.html" class="topiclink">Button</a> widget to the modeling canvas.</span></li><li value="6" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">In the settings window that opens, set the following parameters:</span></li></ol>
|
||||
<ol style="list-style-type:upper-roman" start="5"><ul style="list-style-type:disc">
|
||||
<li style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="font-weight: bold; color: #394149;">Title/Tooltip</span><span style="font-weight: bold; color: #ff0000;">*</span><span style="color: #394149;">. Enter the button</span><span style="font-family: Inter;">’s name, </span><span style="font-family: Inter; font-weight: bold;">Start Test</span><span style="font-family: Inter;">.</span></li><li style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="font-family: Inter; font-weight: bold;">Executed script</span><span style="font-family: Inter;">. Add a script that will change the value of the </span><span style="font-family: Inter; font-weight: bold;">Expand Question 1</span><span style="font-family: Inter;"> variable </span><code><b>(expand_question_1)</b></code><span style="color: #394149;"> to </span><code><b>true</b></code><span style="color: #394149;">. To do that, click </span><span style="font-weight: bold; color: #394149;">Create</span><span style="color: #394149;">, enter the function name:</span><span style="font-weight: bold; color: #394149;"> expand_panel</span><span style="color: #394149;">, click</span><span style="font-weight: bold; color: #394149;"> Save</span><span style="color: #394149;">, and then select</span><span style="font-weight: bold; color: #394149;"> Open</span><span style="color: #394149;">.</span></li></ul></li></ol>
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 14px;"><img alt="widget-scripts-3" width="729" height="337" style="margin:0;width:729px;height:337px;border:none" src="widget-scripts-3.png"/></p>
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 0;"><span style="color: #394149;">On the </span><span style="font-weight: bold; color: #394149;">Scripts</span><span style="color: #394149;"> tab that opens, write the following script in the created function: </span></p>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">async function expand_panel(): Promise<void>{</span><br />
|
||||
<span class="f_CodeExample"> Context.data.expand_question_1 = true </span><br />
|
||||
<span class="f_CodeExample">}</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="7">
|
||||
<li value="7" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;">Save the settings.</li><li value="8" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;">Inside the <span style="font-weight: bold;">Panel with header</span> widget, place the <span style="font-weight: bold;">Category</span> type variable with the first question that you created earlier. To do that, on the right-side panel of the interface designer, switch to the <span style="font-weight: bold;">Properties</span> tab and drag the field to the widget. On the page, the property will be displayed as the <a href="form_line_widget.html" class="topiclink">Field</a> widget.</li></ol>
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 0;"><img alt="script-use-cases-3" width="657" height="179" style="margin:0;width:657px;height:179px;border:none" src="script-use-cases-3.png"/></p>
|
||||
<ol style="list-style-type:upper-roman" start="9">
|
||||
<li value="9" class="p_Normal">Add as many panels to the modeling canvas as you have questions. Set names for each panel. In the <span style="font-weight: bold;">Collapsible</span> field, select <span style="font-weight: bold;">Yes</span>, in the <span style="font-weight: bold;">Expanded</span> field, <span style="font-weight: bold;">No</span>. Place the properties with the questions into the panels.</li><li value="10" class="p_Normal">Save and publish the changes.</li></ol>
|
||||
<p class="p_Normal">Now all the questions are collapsed when the page opens. When the user clicks <span style="font-weight: bold;">Start Test</span>, the first question automatically expands.</p>
|
||||
<h2 class="p_Heading2"><span class="f_Heading2">Information box</span></h2>
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 0;"><span style="color: #394149;">In the test, there is only one possible answer for each question. If the user selects several answers, an <a href="information_block.html" class="topiclink">Information box</a> with a warning should be displayed. The box disappears when the user hovers the mouse over it.</span></p>
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 0;"><span style="color: #394149;">To set up the information box, do the following:</span></p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="1" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">In the <a href="360027211631.html" class="topiclink">interface designer</a>, on the </span><span style="font-weight: bold; color: #394149;">Context</span><span style="color: #394149;"> tab, create a variable of the <a href="360009707032.html#yes-no-switch" class="topiclink">Yes/No switch</a> type called </span><span style="font-weight: bold; color: #394149;">One answer?</span><span style="color: #394149;"> </span><code><b>(one_answer)</b></code><span style="color: #394149;">.</span></li><li value="2" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">Add the </span><span style="font-weight: bold; color: #394149;">Information box</span><span style="color: #394149;"> widget to the modeling canvas. In the settings window that opens, in the </span><span style="font-weight: bold; color: #394149;">Hide</span><span style="color: #394149;"> field, select </span><span style="font-weight: bold; color: #394149;">Show on condition</span><span style="color: #394149;">. Then specify the </span><span style="font-weight: bold; color: #394149;">One answer?</span><span style="color: #394149;"> variable. Whether the information box is shown will depend on the value of this variable.</span></li></ol>
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 0;"><img alt="widget-scripts-4" width="862" height="412" style="margin:0;width:862px;height:412px;border:none" src="widget-scripts-4.png"/></p>
|
||||
<ol style="list-style-type:upper-roman" start="3">
|
||||
<li value="3" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">The number of answers selected by the user needs to be checked. To set up the checking, do the following:</span></li></ol>
|
||||
<ol style="list-style-type:upper-roman" start="4"><ul style="list-style-type:disc">
|
||||
<li style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">Select the </span><span style="font-weight: bold; color: #394149;">Field</span><span style="color: #394149;"> widget containing the first question and open its settings by clicking the gear icon:</span></li></ul></li></ol>
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 0;"><img alt="widget-scripts-5" width="630" height="159" style="margin:0;width:630px;height:159px;border:none" src="widget-scripts-5.png"/></p>
|
||||
<ol style="list-style-type:upper-roman" start="5"><ul style="list-style-type:disc">
|
||||
<li style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">Go to the </span><span style="font-weight: bold; color: #394149;">Events</span><span style="color: #394149;"> tab and add a script that will check the number of selected answers and change the value of the </span><span style="font-weight: bold; color: #394149;">One answer?</span><span style="color: #394149;"> variable. To do that, click </span><span style="font-weight: bold; color: #394149;">Create</span><span style="color: #394149;">, then </span><span style="font-weight: bold; color: #394149;">Open</span><span style="color: #394149;">.</span></li><li style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">The </span><span style="font-weight: bold; color: #394149;">Scripts</span><span style="color: #394149;"> tab in the interface designer will open. Add a script that will define the value of the </span><span style="font-weight: bold; color: #394149;">One answer?</span><span style="color: #394149;"> </span><code><b>(one_answer)</b></code><span style="color: #394149;"> variable, for example:</span></li></ul></li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">async </span><span class="f_CodeExample" style="font-weight: bold;">function</span><span class="f_CodeExample"> checkTest(): Promise<</span><span class="f_CodeExample" style="font-weight: bold;">void</span><span class="f_CodeExample">> {</span><br />
|
||||
<span class="f_CodeExample"> </span><span class="f_CodeExample" style="font-weight: bold;">if</span><span class="f_CodeExample"> (Context.data.question_1 && Context.data.question_1.length > 1) {</span><br />
|
||||
<span class="f_CodeExample"> Context.data.one_answer = </span><span class="f_CodeExample" style="font-weight: bold;">true</span><br />
|
||||
<span class="f_CodeExample"> } </span><span class="f_CodeExample" style="font-weight: bold;">else</span><span class="f_CodeExample"> {</span><br />
|
||||
<span class="f_CodeExample"> Context.data.one_answer = </span><span class="f_CodeExample" style="font-weight: bold;">false</span><span class="f_CodeExample">;</span><br />
|
||||
<span class="f_CodeExample"> }</span><br />
|
||||
<span class="f_CodeExample">}</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="4">
|
||||
<li value="4" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">In the settings of the </span><span style="font-weight: bold; color: #394149;">Information box</span><span style="color: #394149;"> widget, go to the </span><span style="font-weight: bold; color: #394149;">Events</span><span style="color: #394149;"> tab and add a script to the </span><span style="font-weight: bold; color: #394149;">On mouse enter handler</span><span style="color: #394149;">. This script should change the value of the </span><span style="font-weight: bold; color: #394149;">One answer?</span><span style="color: #394149;"> </span><code><b>(one_answer)</b></code><span style="color: #394149;"> variable to </span><code><b>false</b></code><span style="color: #394149;">:</span></li></ol>
|
||||
<p class="p_CodeExample" style="white-space: normal; page-break-inside: avoid;"><span class="f_CodeExample">async function closeInformationBox(): Promise<void> {</span><br />
|
||||
<span class="f_CodeExample"> Context.data.one_answer = false </span><br />
|
||||
<span class="f_CodeExample">}</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="5">
|
||||
<li value="5" class="p_Normal">Save and publish the changes.</li></ol>
|
||||
<h2 class="p_Heading2"><span class="f_Heading2">Pop-up window</span></h2>
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 0;"><span style="color: #394149;">When the user finishes the test, they click the </span><span style="font-weight: bold; color: #394149;">Check Results</span><span style="color: #394149;"> button. After that, the page will show a pop‑up window with the test results.</span></p>
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 0;"><span style="color: #394149;">To configure the pop-up window, do the following:</span></p>
|
||||
<ol style="list-style-type:upper-roman">
|
||||
<li value="1" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">In the <a href="360027211631.html" class="topiclink">interface designer</a>, on the </span><span style="font-weight: bold; color: #394149;">Context</span><span style="color: #394149;"> tab, create a variable of the <a href="360009707032.html#yes-no-switch" class="topiclink">Yes/No switch</a> type called </span><span style="font-weight: bold; color: #394149;">Correct?</span><span style="color: #394149;"> </span><code><b>(correct)</b></code><span style="color: #394149;">. It will store the test results.</span></li><li value="2" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">Add the <a href="modal_window.html" class="topiclink">Modal window</a> widget to the modeling canvas.</span></li><li value="3" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">In the widget</span><span style="font-family: Inter;">’s settings, in the </span><span style="font-family: Inter; font-weight: bold;">Show window</span><span style="font-family: Inter;"> field, specify the variable created in step 1. Whether the modal window is shown will depend on the value of this variable.</span></li></ol>
|
||||
<p style="line-height: 1.20; background: #ffffff; margin: 0 0 11px 0;"><img alt="widget-scripts-6" width="520" height="328" style="margin:0;width:520px;height:328px;border:none" src="widget-scripts-6.png"/></p>
|
||||
<ol style="list-style-type:upper-roman" start="4">
|
||||
<li value="4" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">Add the <a href="button_widget.html" class="topiclink">Button</a> widget to the modeling canvas.</span></li></ol>
|
||||
<ol style="list-style-type:upper-roman" start="5">
|
||||
<li value="5" style="line-height: 1.20; background: #ffffff; margin-top: 0; margin-right: 0; margin-bottom: 11px;"><span style="color: #394149;">In the button</span><span style="font-family: Inter;">’s settings, in the </span><span style="font-family: Inter; font-weight: bold;">On click handler</span><span style="font-family: Inter;">, add a script that will change the value of the </span><span style="font-weight: bold; color: #394149;">Correct?</span><span style="color: #394149;"> </span><code><b>(correct)</b></code><span style="color: #394149;"> variable to </span><code><b>true</b></code><span style="color: #394149;">, for example:</span></li></ol>
|
||||
<p class="p_CodeExample" style="page-break-inside: avoid;"><span class="f_CodeExample">async </span><span class="f_CodeExample" style="font-weight: bold;">function</span><span class="f_CodeExample"> resultTest(): Promise<</span><span class="f_CodeExample" style="font-weight: bold;">void</span><span class="f_CodeExample">> {</span><br />
|
||||
<span class="f_CodeExample"> </span><span class="f_CodeExample" style="font-weight: bold;">if</span><span class="f_CodeExample"> (Context.data.question_1 && Context.data.question_1.length == 1) {</span><br />
|
||||
<span class="f_CodeExample"> </span><span class="f_CodeExample" style="font-weight: bold;">for</span><span class="f_CodeExample"> (let i of Context.data.question_1) {</span><br />
|
||||
<span class="f_CodeExample"> </span><span class="f_CodeExample" style="font-weight: bold;">if</span><span class="f_CodeExample"> (i.code == "n1") {</span><br />
|
||||
<span class="f_CodeExample"> Context.data.correct = </span><span class="f_CodeExample" style="font-weight: bold;">true</span><span class="f_CodeExample">;</span><br />
|
||||
<span class="f_CodeExample"> }</span><br />
|
||||
<span class="f_CodeExample"> </span><span class="f_CodeExample" style="font-weight: bold;">else</span><span class="f_CodeExample"> {</span><br />
|
||||
<span class="f_CodeExample"> Context.data.correct = </span><span class="f_CodeExample" style="font-weight: bold;">false</span><span class="f_CodeExample">;</span><br />
|
||||
<span class="f_CodeExample"> }</span><br />
|
||||
<span class="f_CodeExample"> }</span><br />
|
||||
<span class="f_CodeExample"> }</span><br />
|
||||
<span class="f_CodeExample"> </span><span class="f_CodeExample" style="font-weight: bold;">else</span><span class="f_CodeExample"> {</span><br />
|
||||
<span class="f_CodeExample"> Context.data.correct = </span><span class="f_CodeExample" style="font-weight: bold;">false</span><span class="f_CodeExample">;</span><br />
|
||||
<span class="f_CodeExample"> }</span><br />
|
||||
<span class="f_CodeExample">}</span></p>
|
||||
<ol style="list-style-type:upper-roman" start="6">
|
||||
<li value="6" class="p_Normal">Save and publish the changes.</li></ol>
|
||||
|
||||
<div class="bottom-nav">
|
||||
|
||||
<a id="prev-link" class="topic__navi_prev" href="user-validation.html">
|
||||
<span class="bottom-nav__arrow bottom-nav__arrow--prev"></span> <span
|
||||
class="bottom-nav__link">user-validation.html</span>
|
||||
</a>
|
||||
|
||||
|
||||
<a id="next-link" class="topic__navi_next" href="event-in-widgets.html">
|
||||
<span class="bottom-nav__link">event-in-widgets.html</span> <span
|
||||
class="bottom-nav__arrow bottom-nav__arrow--next"></span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
<!-- добавляет на страницу строку блок Была ли статья полезной? -->
|
||||
<div class="feedback" id="feedback"><div class="feedback-help"><span><b>Was this helpful?</b></span><form action="" method="POST" class="feedback-form" id="feedback-form"><div class="feedback__popup feedback__popup-response" id="feedback__popup_thx" style="display: none;">Thanks for your feedback!</div><div class="feedback__popup" id="feedback__popup_why" style="display: none;"><div class="feedback__popup-header">Please specify why:</div><input type="radio" name="category" id="bad_recommendation" value="bad_recommendation"><label for="bad_recommendation">Recommendations did not help me</label><input type="radio" name="category" id="difficult_text" value="difficult_text"><label for="difficult_text">Article is hard to understand</label><input type="radio" name="category" id="no_answer" value="no_answer"><label for="no_answer">Didn`t answer my question</label><input type="radio" name="category" id="bad_header" value="bad_header"><label for="bad_header">Content does not match the topic</label><input type="radio" name="category" id="other_reason" value="other_reason"><label for="other_reason">Other</label></div><div class="feedback__popup" id="feedback__popup-other" style="display: none;"><div class="feedback__popup-header">How we can improve it?</div><textarea class="feedback__textarea" name="other" id=""></textarea><input type="submit" class="feedback__other-btn" value="Submit"></div><div class="feedback-form__btn-group"><input type="radio" name="useful" id="feedback__useful_yes" value="true"><label for="feedback__useful_yes"><img src="like.svg" class="small-img" alt="like"><spanclass="feedback-form__btn-group_yes-btn">Yes</spanclass="feedback-form__btn-group_yes-btn"></label><input type="radio" name="useful" id="feedback__useful_no" value="false"><label for="feedback__useful_no"><img src="dislike.svg" class="small-img" alt="dislike"><spanclass="feedback-form__btn-group_no-btn">No</spanclass="feedback-form__btn-group_no-btn"></label></div><select name="category"><option disabled="">Please specify why</option><option value="bad_recommendation" selected="">Recommendations did not help me</option><option value="difficult_text">Article is hard to understand</option><option value="no_answer">Didn`t answer my question</option><option value="bad_header">Content does not match the topic</option><option value="other_reason">Other</option></select><input type="submit"></form></div><div class="found_typo"><p style="margin: 0px; margin-top: 16px !important;"><span><b>Found a typo?</b></span> Select it and press <i>Ctrl+Enter</i> to send us feedback</p></div></div>
|
||||
|
||||
</section>
|
||||
</div>
|
||||
<aside class="article__sidebar" style="display:none">
|
||||
<input type="checkbox" />
|
||||
<div class="article__arrow"></div>
|
||||
<div class="table-of-contents elma365-right" id="toc2Content">
|
||||
<h3 class="h3-toc">In this topic</h3>
|
||||
<nav id="toc2"></nav>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</article>
|
||||
</main>
|
||||
<footer class="footer">
|
||||
<div class="footer-container">
|
||||
<div class="footer-mobile">
|
||||
|
||||
<ul class="footer-mobile__list"><li><a href="https://brix365.com/en/" target="_blank">BRIX</a></li><li><a href="https://tssdk.brix365.com/en/latest/" target="_blank">SDK</a></li><li><a href="https://api.brix365.com/en/" target="_blank">API</a></li></ul><ul class="footer-mobile__list"><li><a href="https://brix365.com/en/help/platform/get-trial.html">Platform</a></li><li><a href="https://brix365.com/en/help/ecm/ecm-functions.html">ECM</a></li><li><a href="https://brix365.com/en/help/service/service-functions.html">Service</a></li><li><a href="https://brix365.com/en/help/projects/projects-functions.html">Projects</a></li></ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="footer-wrap">
|
||||
|
||||
<div><span class="mobile-question-popup">Send feedback</span><form method="POST" action class="question__popup question-xs" id="question__popup"><div class="question-wrap"><span class="close"></span><span class="title">Ask a question</span><label for="help_question" style="display: none;"></label><textarea name="help_question" id="help_question"></textarea><input type="submit" value="Send"></div></form><div class="hidden fade-in question-success-xs">Sent</div></div>
|
||||
|
||||
<div class="footer-flex-b">
|
||||
<span class="footer-copy">© 2025 BRIX</span>
|
||||
<ul class="footer-list">
|
||||
|
||||
<li class="footer-item">
|
||||
<a href="#" class="arrow-top" style="display: block;"></a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</footer>
|
||||
<iframe name="hmnavigation" style="display:none!important"></iframe>
|
||||
<script src="./jquery-ui.js"></script>
|
||||
<!--script src="//cdn.jsdelivr.net/npm/featherlight@1.7.14/release/featherlight.min.js" type="text/javascript" charset="utf-8"></script-->
|
||||
<script src="./jquery.tocify.min.js"></script>
|
||||
<script src="./TypoReporter.min.js"></script>
|
||||
<script src="./google-search.js"></script>
|
||||
<script src="./main.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
Reference in New Issue
Block a user