Skip to content

Commit 364af39

Browse files
committed
Prefill bug fix
1 parent 970a1dc commit 364af39

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

InstanceTable.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function redcap_every_page_top($project_id) {
8282
} else if (PAGE==='DataEntry/index.php' && isset($_GET['id']) && isset($_GET['page'])) {
8383
global $Proj;
8484
$allowPrefill = $this->getProjectSetting('allow-prefill');
85-
if (empty($allowPrefill)) return;
85+
if (empty($allowPrefill) && !isset($_GET['extmod_instance_table'])) return;
8686
if (!isset($Proj->forms[$this->escape($_GET['page'])]['fields'])) return; // do nothing if $_GET['page'] not valid
8787
foreach (array_keys($Proj->forms[$this->escape($_GET['page'])]['fields']) as $formField) {
8888
if (isset($_GET[$formField]) && $_GET[$formField]!='') {
@@ -852,9 +852,9 @@ function getPrefillParams(tblFld) {
852852
console.log(tblFld);
853853
var prefill = '';
854854
$('tr[sq_id=tbl]').find('div.MCRI_InstanceTable-prefill-container').find('div.MCRI_InstanceTable-prefill').each(function(i,elem){
855-
var thisPF = $(elem).html();
856-
var stripPipingReceivers = thisPF.replace(/<span class="piping_receiver piperec-(\d)+-(\w)+">(.*)<\/span>/gm,'$3');
857-
prefill += '&'+stripPipingReceivers;
855+
var thisPF = $(elem).html().split(/=(.+)/s);
856+
var stripPipingReceivers = thisPF[1].replace(/<span class="piping_receiver piperec-(\d)+-([\w-])+">(.*)<\/span>/,'$3');
857+
prefill += '&'+thisPF[0]+'='+encodeURIComponent(stripPipingReceivers);
858858
});
859859
return prefill;
860860
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Include an "Add New" button using a descriptive text field containing an HTML bu
2626
<a class="btn btn-success text-decoration-none" href="[survey-url:my_repeating_survey][new-instance]"><i class="fas fa-plus"></i> Add New</a>
2727
```
2828
#### Links to Edit Specific Survey Instances
29-
If you wish to provide the buttins that enable access to individual instances of a repeating surveys for editing, then include a `@CALCTEXT` field in your repeating survey that generates the HTML for an "Edit" button. In this example, the instance has an "Edit" button up until it has been completed, at which point the button changes to just a check mark to indicate completion:
29+
If you wish to provide buttons that enable access to individual instances of a repeating surveys for editing, then include a `@CALCTEXT` field in your repeating survey that generates the HTML for an "Edit" button. In this example, the instance has an "Edit" button up until it has been completed, at which point the button changes to just a check mark to indicate completion:
3030
```
3131
@CALCTEXT(
3232
if(

0 commit comments

Comments
 (0)