Feature Request: Field Editor List Options - advance mysql query

4 posts by 3 authors in: Forums > CMS Builder
Last Post: July 18   (RSS)

Since the option for "get options for MySQL query" uses mysql statements, it would be great if this could be formatted for code with line numbers instead of a no-wrap text box.

USE Case

SELECT 0 as num, "" as title
UNION
SELECT num, title
  FROM `<?php echo $TABLE_PREFIX ?>locations`
WHERE use_company_lookup  = 1
Jeff Shields

Unfortunately, this didn't work. I have the following error in the concole.

Uncaught TypeError: Window.getComputedStyle: Argument 1 is not an object.
    textareaToAceEditor https://yaaws5.yaa.test/cmsb/lib/admin_functions.js?v=1720050496:585
    <anonymous> https://yaaws5.yaa.test/cmsb/admin.php?menu=database&action=editField&tableName=cmsb_bios&fieldname=locations&:681
Jeff Shields

By TimHurd - July 18 - edited: July 18

Hi Jeff,

I am new to CMS Builder but I thought I could pitch in with an answer. Dave's solution will work, but is missing a few more details. 

On the textarea element with the name "optionsQuery" a few lines up from the "Available vars" line, add two additional attributes. One is

id="optionsQuery"

and another is...

style="height: 300px;"

So in the end your textarea element should look like the following...

<textarea name="optionsQuery" id="optionsQuery" cols="60" rows="3" style="height: 300px;" class="form-control text-nowrap setAttr-spellcheck-false textareaGrow" data-growsize="10"><?php echo htmlencode($field['optionsQuery']) ?></textarea>

I believe after this change, the JavaScript Dave gave you should turn that box into an editor box with line numbers. Attached is a screenshot.

Now of course I don't know if it is safe to edit these files and if they will be overwritten by future updates, but at least it can get that working for now and perhaps Dave's team can then put it in as part of core.

I hope this is what you were looking to do. :)

Tim Hurd
Senior Application Developer
TimHurd.com
Attachments:

mysql-options-editor.png 26K