Client Scripts for OOB DOM Manipulation

IanGlencross
Kilo Expert

I know.   I know.   We don't do that.

          However . . .

We have just jumped from Dublin to Geneva and all our users are crying about the tiny text boxes in the work_notes / comments fields.  

find_real_file.png

And since the white space is never going to be used by "form-field-addons" for these particular fields, in this particular form, I thought I'd fix it with a short client script using prototype.  

When (if) it stops working after the upgrade to Helsinki I can apply another fix at that point.   It's not the best solution .. but it looked easy enough for a quick win

So here is what I wrote :.

find_real_file.png

But it didn't work.

I have set glide.script.block.client.globals to false, and I'm pretty certain I am targeting the right elements

Does anyone have any ideas why this didn't work, or a better solution to this issue?

1 ACCEPTED SOLUTION

IanGlencross
Kilo Expert

The issue was with the selectors.



Both prototype and jquery can't handle id selectors that have periods (.) in them.



To get the selectors to work you need to escape (use \) the special characters.   This also applies to id's that have # and : in them.


The correct   prototype selector statement is :



$$('#element\.incident\.comments div').each( ....


View solution in original post

5 REPLIES 5

IanGlencross
Kilo Expert

The issue was with the selectors.



Both prototype and jquery can't handle id selectors that have periods (.) in them.



To get the selectors to work you need to escape (use \) the special characters.   This also applies to id's that have # and : in them.


The correct   prototype selector statement is :



$$('#element\.incident\.comments div').each( ....