ctsit / search_and_populate_data_from_another_project

REDCap Module to search another project for data to populate data into the current form
Other
5 stars 2 forks source link

Add the ability to control where the Data Search box is located #21

Open ghost opened 3 years ago

ghost commented 3 years ago

This is an awesome module! I would like to propose two enhancements for your consideration:

  1. Enable surveys to use this feature.
  2. Add the ability to control where the Data Search box is located on the form/survey. Perhaps in the configuration, we can specify the field that the data search should be located by and also specify if it should be above that field or below that field.

Thank you for considering.

ChemiKyle commented 3 years ago

Hi @maples99,

I believe we've corresponded via email, but I wanted to respond to this issue with my minimal scripts I made while looking into 2.

I'd like to integrate this into a new custom UI, but to accomplish this with the current hijacking of DataEntry's Data Search box, the following snippet of JS implements this feature, though it's quite unsightly.

target_field_name = "edit_me_please";
searchBox = $("td.header:contains('Data Search')").closest('table');
$(`[sq_id='${target_field_name}']`).after(searchBox);

image

It may be possible to use the REDCap JavaScript Injector module to implement this without a module update, but you'll need to wrap it in some waits and would need to add some siblings to make it look closer to the surrounding fields.