Attention:

Support Rules and Guidelines
Before you post your support topic, please remember to:
  • Read the support forum rules.
  • Check the wiki and use search to see if your problem can be answered there first.
  • Link your board please, and make sure that the problem on your board is visible to guests or provide a test account.
  • Do not post Board Wrappers and CSS unless requested. With a board link, this is not necessary.
  • Be as descriptive as you can and use as many details as possible when describing your problem.
  • Please briefly mark any links to forums that may not be work-safe.
This will help ensure your support issue will be attended to in a quick and efficient manner.

  Add ReplyNew TopicNew Poll

 JS cannot interact with topic title/desc inputs
#
Hi there,

Was putting the final touches to a post saving script, and I've discovered I absolutely cannot for the life of me interact with the topic title or topic description input fields. Debugging console is showing a plain 'operation is insecure' no matter what I try - whether it be a val statement or a remove. I can't even set CSS styles on it. What gives?
PM
#
How are you attempting to do it? Operation is insecure would be a browser limitation, not something from the server end.

signature
email: admin@jcink.com :: blog: John C.
#
Sorry, didn't mean to sound so rude and hotheaded.

I normally set inputs through JQuery by .val(), like $('#topic-title .pformright input').val('blah'), but I've realized I can't use any methods on those selectors without it throwing an 'operation is insecure'. It certainly seems to be an error in JQuery itself since I was able to at least change the input's type from text to input through regular old JS.

Interestingly, setting the value of the posting form textarea works just fine - but also throws the same insecure operation error.
PM
#
Try deleting <% JAVASCRIPT %> from wrappers and choose a newer jquery version and see if the problem persists. Grab one from https://code.jquery.com/

If the problem persists it has to be an issue with something that JQ itself is doing that the browser is upset about.

signature
email: admin@jcink.com :: blog: John C.
#
I thought that might be the trouble, but I've been through a few different versions of JQuery already.

I checked it in Chrome's developer tools, and it gave me an error message that's actually somewhat helpful.

CODE
jquery.min.js:2 Uncaught InvalidStateError: Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string.


But given that the element in question accepts text and not a filename:
CODE
<input type="text" size="40" maxlength="50" name="TopicTitle" value="" tabindex="1" class="forminput">


I'm a little confused now.

PM
#
It's almost as if it's mistakenly targeting the attachment input... is the attachment input on the page?

signature
email: admin@jcink.com :: blog: John C.
#
Yup, that did it for some reason. In specific, the element that causes the problem is the file manager input:
CODE
<input class="textinput" type="file" size="30" name="FILE_UPLOAD[]">


But I guess now the question is: .. what? I narrowed the selector down using #topic-title .pformright input, so it shouldn't be going anywhere near the file upload manager.

This post has been edited by DustBucket: May 11 2017, 05:09 PM
PM
#
Has to be a bug... if you want I can look at adding a more specific class to see if we can evade this issue

signature
email: admin@jcink.com :: blog: John C.
#
Actually, it turns out changing the class of the file_upload() input clears the security error, but changing the class of the topic title and description inputs does not, furthering the question of whaaaaaaaaaaaat?
PM
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Share this topic:
« Next Oldest | General Support | Next Newest »

Options Add ReplyNew TopicNew Poll