Codes and Scripts samples to use it with SPARK forms Builder2312
10/21/2018 8:57 AMcode
  
Picture: Nancy Castelo
  • Nancy Castelo
19/23/2018 1:40 AM

​Hi,

how would i manage to collect all the peoplepicker values in several rows of a repeater and save the collected accounts into the list's "Person or Group" column?

Mike Odeh9/23/2018 5:54 AMNoCodes & Scripts
6.85726062538364
11901319/20/2018 7:58 AM11
Mike Odeh
  
Picture: Jim Hidson
  • Jim Hidson
19/20/2018 9:03 AM

​Can we change the redirection of form page while submission?

Jim Hidson9/23/2018 5:47 AMNoCodes & Scripts
6.72261942167994
11403609/20/2018 8:29 AM11
Jim Hidson
  
Picture: Mike Odeh
  • Mike Odeh
19/20/2018 8:55 AM

Hi, I was trying to set a dynamic where Clause ​in the SQL Connector control, where the current user login equales the employee login name in the sql table's column, but the query always returns nothing becuase the current user login fubction returns 'i:0#.w|domain\login_name

any ideas ?


 

Jim Hidson9/23/2018 5:45 AMNoCodes & Scripts
6.7223468522355
11204609/20/2018 8:47 AM11
Jim Hidson
  
Picture: Jim Hidson
  • Jim Hidson
19/20/2018 8:53 AM

Hi, I was wondering how could I allows multiple external SQL records to be populated into a form. For instance, can I populate a check box list with multiple journal names from a SQL query?
Is there a way to accomplish this?

Jim Hidson9/23/2018 5:44 AMNoCodes & Scripts
6.72227682908735
11403609/20/2018 8:29 AM11
Jim Hidson
  
Picture: Mike Odeh
  • Mike Odeh
19/20/2018 8:49 AM

​Hi, I am programming a repeater to be populated from a lookup control. It works when I do not pass any parameters; however, when I do program the form to pass parameters I get a syntax error. I was wondering if anyone could look at my code and see if there is something I am missing as far as syntax goes. Thanks for your help!

generateRepeaterRowValues(Repeater2,'https://Domain/SC/Site','list',
'<Query><Where><Eq><FieldRef Name='Proposal' /><Value Type='Text' >'+ getValue(Proposal)
+'</Value></Eq></Where></Query>',
['Proposal','Proposal_x0020_Title','Experiment','Experiment_x0020_Title'],['P2','PTitle2','E2','ETitle2']);

Jim Hidson9/23/2018 5:38 AMNoCodes & Scripts
6.72216108834661
11204609/20/2018 8:47 AM11
Jim Hidson
  
Picture: Jim Hidson
  • Jim Hidson
19/23/2018 1:53 AM

​How could I save the repeater's rows in a different list using a custom button?

Jim Hidson9/23/2018 3:28 AM78NoCodes & Scripts
6.85769291705031
11403609/20/2018 8:29 AM1
  
Picture: Mike Odeh
  • Mike Odeh
49/20/2018 8:47 AM

​is there is any way that i can repsond to an approval task of a workflow designed by sharepoint designer therough SPARK forms, i want the user to open a section within this form and aprrove or reject the request.

Mike Odeh9/23/2018 3:17 AM76NoCodes & Scripts
7.30565376194352
31204609/20/2018 8:47 AM11
Jim Hidson
  
Picture: Jim Hidson
  • Jim Hidson
09/23/2018 2:14 AM

​This video will show you how you can allow your form's users to select and upload files to your SharePoint farm and link them in your form through the files explorer dialog and without the need to do any manual operation like what users have to do when using InfoPath forms. This can be done easily using SPARK Forms Builder by creating a simple rule on a button. In less than 5 minutes you will be able to provide your users with a great technique to work with files, images ..etc and manage to integrate them with your different form's controls such as image and hyperlink controls.

 

​​​

9/23/2018 2:14 AMNoCodes & Scripts
0
1,030154239/19/2018 7:49 AM1
  
Picture: Jim Hidson
  • Jim Hidson
09/23/2018 2:12 AM

This video will show you how you can execute SQL procedures in SharePoint using SPARK Forms Builder. You can use the SQL connector control to do that easily using the control configuration wizard dialog. you will be able to execute "Post" method for the procedure in order to add, update or delete database records and the "Get" method to retrieve records from database. the SQL Connector allows to creating a dynamic call by connecting the procedure parameters with form's controls and variables.

 


9/23/2018 2:12 AMNoCodes & Scripts
0
1,030154239/19/2018 7:49 AM1
  
Picture: Jim Hidson
  • Jim Hidson
09/23/2018 2:11 AM

​This video will show you how you can create master-details Forms in SharePoint using SPARK Forms Builder. You can create a complicated (master-details) relational form between two or more lists using just the repeater control and a single rule, easily in 15 seconds, and have a fully functioning form in which you can retrieve, add, update and delete the details records without having to write a single line of code. You will be able to do all that using a wizard dialog which will make creating such forms a very easy job to do.

 


9/23/2018 2:11 AMNoCodes & Scripts
0
1,030154239/19/2018 7:49 AM1
  
Picture: Jim Hidson
  • Jim Hidson
09/23/2018 2:07 AM

​I have received the following questions regarding dealing with SPARK forms URL parameters and how to deal with them:

1. How do I test whether or not the parameter is even present in the URL? I have tried isEmpty()/isNotEmpty() and length() functions but get "Unable to get property 'character' of undefined or null reference" error when I try to save. If I use =='' or !='' then the rule doesn't seem to work either.

2. How can I set the value of a field on the form to what is entered in for the parameter? The setValue() function does not allow getFormQueryString() to be used as the value. I get the same error as in #1.

The Answer:

1-      getFormQueryString('The Parameter')!=null

2-      you have Two ways to do that:
a)

setValue(TextBox5,getFormQueryString('source')!=null?getFormQueryString('source'):'')

b)

try{

setValue(TextBox5,getFormQueryString('source'))

}catch(ev){}

9/23/2018 2:07 AMNoCodes & Scripts
6.08005034722222
11,030154239/19/2018 7:49 AM11
Jim Hidson
  
Picture: Jim Hidson
  • Jim Hidson
09/23/2018 2:06 AM

 

In order to calculate the number of working days between two dates in SPARK you can use the following script which substitutes the weekend days from the total number of days between these two dates.

Controls: Date1, Date2 , TextBox1

Script:

function getWeekendDays(d1,d2){
    var start = new Date(d1),
    finish = new Date(d2),
    dayMilliseconds = 1000*60*60*24;
    var weekendDays = 0;
    while (start <= finish) {
      var day = start.getDay()
      if (day == 0 || day == 6) {
         weekendDays++;
        }
      start = new Date(+start + dayMilliseconds);
    }

    return weekendDays
}

var weekendday= getWeekendDays(getValue(Date1),getValue(Date2))

var differnceDay=calculateDays(Date1,Date2)+1

var numberOfFinalDays=differnceDay-weekendday
 
setValue(TextBox1,numberOfFinalDays)

 

9/23/2018 2:06 AMNoCodes & Scripts
0
1,030154239/19/2018 7:49 AM1
  
Picture: Mike Odeh
  • Mike Odeh
19/20/2018 9:36 AM

​I have faced this case:

In my CAML query I want to retrieve the related items to display. Here is my action rule: generateRepeaterRowValues(RepeaterMeetings,'','FE40B08F-E08F-49EA-BD44-914E33AE3F4D','<Query><Where><Eq><FieldRef Name=\'ConsolidatedProject\' LookupId=\'TRUE\' /><Value Type=\'Lookup\'>11</Value></Eq></Where></Query>',['Title','Note','Author','Created'],['CPMTitle','CPMNote','CPMCreatedBy','CPMCreated'],true)

The results for Author returns '55', how do I get it to say User name instead of the internal SharePoint user ID ?

Jim Hidson9/23/2018 1:58 AMNoCodes & Scripts
6.72376062538364
11204609/20/2018 8:47 AM11
Jim Hidson
  
Picture: Jim Hidson
  • Jim Hidson
09/20/2018 9:49 AM

 

 

The following characters are recognized in the Format property of the DateTime control. The format specified in the Format property should be a correct date/time format (please sees below example).

 

Format Description
Day
FA full textual representation of a month, such as January or March
mNumeric representation of a month, with leading zeros
MA short textual representation of a month, three letters
nNumeric representation of a month, without leading zeros
Year
YA full numeric representation of a year, 4 digits
yA two digit representation of a year
Time
aLowercase Ante meridiem and Post meridiem
AUppercase Ante meridiem and Post meridiem
BSwatch Internet time
g12-hour format of an hour without leading zeros
G24-hour format of an hour without leading zeros
h12-hour format of an hour with leading zeros
H24-hour format of an hour with leading zeros
iMinutes with leading zeros
sSeconds, with leading zeros
uMicroseconds. Will always generate 000000.

 

Examples: You can represent date 10/10/2017 in the following formats:

Format Result
m/d/Y H:i:s a10/10/2017 11:52:25 am
F d, YOctober 10, 2017
M d, YOct 10, 2017
M d, yOct 10, 17
M d, y g:iOct 10, 17 12:03
M d, y g:i:sOct 10, 17 12:04:23
m/d/Y H:i:s a10/10/2017 12:13:09 pm

 


9/20/2018 9:49 AMNoCodes & Scripts
0
1,030154239/19/2018 7:49 AM1
  
Picture: Jim Hidson
  • Jim Hidson
09/20/2018 9:38 AM

For setting the value of the Created column for example to a datetime control please change the control format in the control’s properties to be : Y-m-d H:i:s if you use Georgian USA calendar for example, or set the format to match the your server's regional date calendar.

 


 

9/20/2018 9:38 AMNoCodes & Scripts
0
1,030154239/19/2018 7:49 AM1
  
Picture: Jim Hidson
  • Jim Hidson
09/20/2018 9:08 AM

​In the upcoming release of SPARK "newer than 3.5.50.102", the designer will be able to retrieve the user profile data using people picker control instead of textbox control like in this video: https://www.youtube.com/embed/NvwdJ0cwdc8

The designer will be able to achieve this using the new function getPeoplePickerValue(PeoplePickerControlID,1) which will allow the designer to get the account name value from the people picker and set it in the getUserProfileData() function, see below example:

var array=getUserProfileData(getPeoplePickerValue(PeoplePicker1,1),['AccountName','DisplayName','FirstName','CellPhone'])

setValue(TextBox1,array[0]);
setValue(TextBox2,array[1]);
setValue(TextBox3,array[2]);
setValue(TextBox4,array[3]);
setValue(TextBox5,array[4]);

In the condition it is better to use this code: getValue(PeoplePicker1)!=''

To prevent unnecessary triggering for the code of retrieving user profile data whenever an action occurs on the form, this will enhance the form performance.

See the attached screenshot

PP-UP.png 

9/20/2018 9:08 AMNoCodes & Scripts
6.24567525029361
21,030154239/19/2018 7:49 AM12
Nancy Castelo
Mike Odeh
  
Picture: Jim Hidson
  • Jim Hidson
09/20/2018 8:22 AM

The designer can display pages in popup dialogs using the Button Control by adding new Rule and then add the following script in an Action area in the Rule Manager.

Example:

function openDilaog() {

var options = { url: _spPageContextInfo.webServerRelativeUrl + '/SiteCollection/Site/List/', title: 'Dialog Title', allowMaximize: true, showClose: true, width: 1000, height: 600 };

SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);

}

onClick(Button1,openDilaog());

popup.jpg

9/20/2018 8:22 AMNoCodes & Scripts
5.94305034722222
11,030154239/19/2018 7:49 AM11
Nancy Castelo
  
Picture: Jim Hidson
  • Jim Hidson
09/20/2018 8:15 AM

​In order to add a custom save button to your form do the follwoing:

1- add a button control to your form.

2- add a rule to the button with type action with onLoad event.

3- If you want to hide the top ribbon Submit button when you open the form in the run mode: Select the View or Views that you want to hide the Submit button by clicking on an empty space insdie the form or by clicking on + sign in the Form Property pane and Under Show Ribbon Button, switch Submit to OFF​.

4- add the folowing code to the rule: onClick(Button1,saveForm());

where is Button1 is your button ID.


 

9/20/2018 8:15 AMNoCodes & Scripts
0
1,030154239/19/2018 7:49 AM1
  
Picture: Jim Hidson
  • Jim Hidson
09/20/2018 8:13 AM

​If you need to hide buttons in the runtime mode of the form, you can do that using the following code:

$(document.getElementById('Ribbon_ID')).hide();

and placing this code in an action rule on any control, selecting the event (onLoad).

Ribbon_ID List:

Attachments Button: Ribbon.FTTab.OpeartionsGrp.AttachmentsBtn-Large

Close Button: ​​​Ribbon.FTTab.OpeartionsGrp.CloseBtn-Large

Reload Button: Ribbon.FTTab.OpeartionsGrp.ReloadBtn-Large

Submit Button: Ribbon.FTTab.OpeartionsGrp.SaveFlyoutAnchor-Large

New Form Button: Ribbon.FTTab.OpeartionsGrp.NewFormBtn-Large

​Send Message Button: Ribbon.FTTab.OpeartionsGrp.MessageBtn-Large

Print Preview Button: Ribbon.FTTab.RevAndPrintGrp.PrintPreviewBtn-Large

Also you can set the condition in the rule to hide these button depending on the form state (View, New, Edit) using the following condition code:

getFormQueryString('type') == 'Disp'​

or 

getFormQueryString('type') == 'New'​

or

getFormQueryString('type') == 'Edit'​

9/20/2018 8:13 AMNoCodes & Scripts
0
1,030154239/19/2018 7:49 AM1
  
Picture: Jim Hidson
  • Jim Hidson
09/20/2018 8:10 AM

1.    Set Current DateTime:

var date = new Date();

var time = date.toLocaleTimeString();

setValue(TextBox1,time)

output: 2/13/2017 4:09:52 PM

 

2.    Change DateTime Format:

var d = new Date();

setValue(TextBox1,d.toLocaleDateString())

output: 2/13/2017 ​

9/20/2018 8:10 AMNoCodes & Scripts
0
1,030154239/19/2018 7:49 AM1
1 - 20Next

 

false,false,1