TinyMCE - setting or configuration to avoid sanitising source code - tinymce

I am using TinyMCE - 6.1.2 version. I would like to retain all the contents entered in TinyMCE as it is (especially while using 'Source Code' option).
Adding the below configuration helps in the majority of the scenarios.
verify_html : false,
But some values like action getting automatically stripped:
<input type='hidden' name='action' value=''>
is getting stripped to:
<input type="hidden" value="">

This is a bug in TinyMCE and the same has been confirmed -
TinyMCE removing 'action' word even after setting verify_html to false
Code Flow:
setContentString
parse
parseAndSanitizeWithContext
DOMPurify.sanitize (iterate through each node)
_sanitizeElements (checks for specific condition and removes the node. There are no configuration to control this. Also element specific validation is done using the hook - uponSanitizeElement )
_sanitizeAttributes (similar to _sanitizeElements, but in this case attributes are removed)
If your element or node is getting removed, please debug the _sanitizeElements or _sanitizeAttributes functions respectively.

Related

Only 1 file gets uploaded even if multiple files have been selected

When I click on my file input button and I select two files in the file dialog, on the add callback I see that the value of data.files.length is 2. Just before calling data.submit(), the value is still 2. However, only 1 file is uploaded.
Why?
Relevant configuration options used are:
autoUpload: false,
singleFileUploads: false,
jQuery File Upload is attached to...
<input id="fileupload" type="file" name="attachment" multiple>
The configuration option you are looking for is MaxNumberOfFiles.
// sets maximum number of files...
$("form#formid").fileupload('option', 'maxNumberOfFiles', 10);
You might also would like to change the input to following
<input id="fileuploadinput" type="file" name="attachment[]" multiple>
// Only reason to change id is so that it may not conflict. You may not have to do it though.
Hopefully this should solve your problem if no other issues are there.

HTML5 multi="true" tag doesn't work

i use Eclipse kepler
in dynamic web project
i create html(HTML5) file and use code for Multi select file upload system
<input type="file" multiple="true" />
but can't select multiple with ctrl+click
and my eclipse has warning
Multiple annotations found at this line :
-Undefined attribute value(true)
-Undefined attribute value(true)
any suggestion?
You need to use the attribute's name as its value:
If the attribute is present, its value must either be the empty string
or a value that is an ASCII case-insensitive match for the attribute's
canonical name, with no leading or trailing whitespace.
(http://www.w3.org/TR/html5/infrastructure.html#boolean-attributes)
In other words, just use:
<input type="file" multiple>
or
<input type="file" multiple="multiple">
If it does not work, then the reason is that you are using a browser that does not support the multiple attribute, such as IE 9. To deal with such browsers, you can add some JavaScript that tests whether the input element has the multiple property and if it does not, creates some additional file input elements (possibly in a loop that lets the user specify any number of files).
The warning should really be an error message, since true is not a valid value for the multiple attribute. As #IlmoEuro explains, the value should be empty or multiple. However, the value has in practice no impact; browsers recognize just the attribute name and ignore the value (even if you write multiple="false" for example).

Customised Error Message for default DateValidator in Wicket

I'm using DateValidator class to validate the date entered by user. I'm getting generic error message for this. Can I customise the error message without creating a separate Validator class.
Yes, for example if you have the following kind of page.
MyPage.html
<wicket:page>
<form wicket:id="form">
<input type="text" wicket:id="startDate" />
<input type="text" wicket:id="endDate" />
</form>
</wicket:page>
Then you add next to your java class a properties file named MyPage.properties in which you add the following entries.
MyPage.properties
form.startDate.DateValidator.minimum=<message for minimum startDate>
form.startDate.DateValidator.maximum=<message for maximum startDate>
form.endDate.DateValidator.minimum=<message for minimum endDate>
form.endDate.DateValidator.maximum=<message for maximum endDate>
You can use variables like ${input} or ${label} to be substituted in the feedback messages.
A good place to start is in the Wiki of Apache Wicket at https://cwiki.apache.org/confluence/x/N1IB
Looking at the API Docs for DateValidator i can see that based on the condition that failed wicket used different error keys ..like : DateValidator.range, DateValidator.minimum, DateValidator.maximum. You can use this keys and create your custom error messages for this situations.

Chrome/HTML5: Input type number not respecting max attribute?

I have the following markup:
<input type="number" max="99" />
In Google Chrome (and possibly other webkit browsers), this will restrict the spinner's up arrow from going over 99, but it does not prevent the user from typing a number higher than 99. Even onblur, the invalid value is not removed/replaced or even a warning given that the value is invalid.
Am I misinterpreting how it's supposed to work, or is this a bug? I am using the latest version of Chrome (19 at the time of writing).
Edit:
To clarify, I want to know why a number greater than the specified max is allowed to be input in the first place. I realize that it gives a tooltip on form submission telling you that it's invalid, but it seems like inconsistent behavior that the spinner will not allow you to go above the max, yet you can simply type a number above the max at any time to circumvent it.
If this is desired behavior for some reason, why is that? And is there a better option to enforcing the input range without resorting to JS?
It does work but you only see an error message (tooltip) if you put a submit button and a form into your code:
<form action="#" method="get">
<input type="number" max="99" />
<input type="submit" value="Submit!" />
</form>
jsFiddle
​
It's an old question, but I didn't find any relevant answers for this question anywhere.
this behaviour is still around in chrome (version 61).
I have found a little trick that can be used in some situation.
it's relevant for those who use data-binding libraries like aurelia, angular etc.. I tested only on aurelia - but that should work also for others.
the trick relies on the fact that input of type range enforce the min/max constraints.
we simply create another input (of type range) that is bounded to the same value as the regular input, and we hide it via css.
when the user inputs something that is greater than the max value, it will snap back to the max value.
here's a demo in aurelia: https://gist.run/?id=86fc278d3837718be4691acd5625aaad

Why do forms timeout in ColdFusion?

We're on CF 8 and we have a CF application with a 1 hour session timeout specified.
<cfapplication sessionmanagement="yes" sessiontimeout="#CreateTimeSpan(0, 0, 60, 0)#" name="myAppName" clientmanagement="yes">
Within the CF administrator, we have a default session timeout of 1 hour, and a max session timeout of 1 day.
We're having some odd (intermittent) form timeout issues on submission of a regular form (not a flash form)...
Let's say the user hits the form page at 10:30am. (I know this because I'm appending the time to the "Action" property of the form tag). At 11:10am, the user submits the form, but none of the form struct is available to the action page, so the user gets an error.
I know that it's coming from the correct page since the CGI.referrer is defined properly.
In my custom error handler, I iterate over any form, session, or client structs -- and there is NO form struct defined at this point. All of the other Session and Client variables ARE still available.
Excerpts from Form Page:
<cfform name="chairsComment" id="chairsComment" action="library/save_chairsComment.cfm?Start=0224_153027" method="post" >
<input name="chairsCommentNumber" id="chairsCommentNumber" type="hidden" value="13" />
<textarea name="comment_13" rows="50" wrap="virtual" cols="100" id="comment_13" ></textarea>
<input name="save_answer" id="save_answer" type="submit" value="Save Response" />
</cfform>
And for the Action page, it throws an error on line 1:
<cfset whichCommentNumber = form.chairsCommentNumber>
It works during testing, but when some of our users use it, it throws the error that "Element CHAIRSCOMMENTNUMBER is undefined in FORM." We've just started looking at the specific browser that this individual is using (Safari 4.0.3) and asked him to upgrade to 5.x, but with SUCH a vanilla form, it seems an unlikely culprit.
Any Ideas?
In the midst of a discussion on Ray Camden's blog about file uploading, someone mentions a problem with Safari 4.0.5 throwing an error because the form field did not contain a file ... it's not the same problem, necessarily, but it could be related. Unfortunately, the commenter never returned with more information.
There's a post on another blog here where a commenter mentions an issue with Safari and a cfform inside a cfdiv tag. If your cfform is similarly nested, you might need to reverse the order (nest the cfdiv inside the form) to make this work.