I'm using the jQuery watermarkinput plugin to place hint text inside text box input fields. When the page POSTs back to the server, the watermark values are POSTed as the input box values.
How do I prevent the watermark values from being POSTed?
Short of validating against the watermark text on submission, you're stuck. The watermark plugin (digitalbush.com) can't help you with that.
Edit
Apparently, it can (globally). As described in the comment:
$.Watermark.HideAll(); // hide's all watermark text
$.Watermark.ShowAll(); // restores watermark text
I'm not familiar with the plugin. But, you could add an onsubmit() event handler to your form and check whether the input box that contains the watermark text in question and clear it out before submitting as in the simplified example below.
<form id="myform">
<input type="text" id="myWatermarkedBox" value="Watermark Text"/>
</form>
Then in your javascript:
$(function(){
$("myform").submit(function(){
if($("myWatermarkedBox").val() == "Watermark Text")){
$("myWatermarkedBox").val('');
}
});
});
I don't know that plugin, but your form fileds would have a class assigned to it when watermark is displayed (most likely). Before submit, check the field for watermark class and if it's present set value of the field to empty
Sounds like your hint text is being directly added to the value of the input. Hence being sent in the POST data. I'm guessing you were trying to overlay the hint text using the watermark plugin (though I'm not familiar with this plugin), but it doesn't seem to be working.
I'll update the answer when the question has more info.
Related
Everyone
I am making blogging site using quill.js. To view post in frontside I am using highlite.js.
In following image first 2 block are displayed with default side just <pre> tag.
and last one with <pre><code class="dart">{code}</code></pre>
My question is
I don't want to add manually html with <code class="dart">
I want automatic set styling by using just tag
I read all document but not found any specific answer how to set?
please any one?
I found answer. Using custom selector.
document.querySelectorAll('pre').forEach((block) => {
hljs.highlightBlock(block);
});
I want to get sanitized data from CKEditor when I use CKEDITOR.instances['textareaId'].getData(); function.
I have noticed CKEditor internally sanitized the input provided in the 'Source' part.
Example
If the input is <p onclick="alert('document.cookie')">Some Text</p> it gets converted to <p>Some Text</p>.
But when I try to retrive the data using CKEDITOR.instances['textareaId'].getData(); it returns <p onclick="alert('document.cookie')">Some Text</p>.
Is there any way where CKEditor sanitize the data when getData() function is called?
From CKEditor point of view don't disable Advanced Content Filter (ACF) - don't use config.allowedContent = true;. That way unwanted HTML attribute will be removed.
Please note however that JavaScript, no matter how good, can always be disabled so ACF by no means can be treated as a security filter. If you wish to sanitize your HTML, please use server-side library for that and not JavaScript. Sanitizing user input with your server-side application code is the only correct way to do it.
It is set by default that when I create input fields and set them to be required, when users don't fill in anything, they got a massage:
Please fill out this field
I am creating a website with Joomla, and this tooltip pops out in every browser displaying the above text. How to change the text.
I tried to look up in Joomla language ini files, but no success. Is there some easy way to change this, or some advice where it could be?
This is not a Joomla string, it's the message displayed by the HTML5 required attribute. To change the message you have to check the loads of suggestions in the following questions:
HTML5 form required attribute. Set custom validation message?
How to change default “please fill out this field” in two field
if you are writing your own component (or module/plugin), it sounds like this is the description - field in the form-xml for your component. If the form is auto-generated from a component-creator, the file should be found in
/(administrator/)components/com_yourcomponent/models/forms
but some more info on where/what you are doing would help.
regards Jonas
I've been trying to amend the code provided by Mailchimp which is included on a site I'm developing for the mailing list form.
Basically the code is included within a table and the Mailchimp code is in one cell of the table. The content is title, box to enter email address and "Submit" button. I would like to amend the code so that the contents of the cell are all on one line rather than under each other as is the current case.
The code and CSS can be found here http://jsfiddle.net/surfersteve1970/x9QLP/
Hopefully I've just done something stupid, as is often the case, but after hitting my head on my desk for the last hour I thought it best to try and ask for some help rather than cause further brain damage.
Thanks in anticipation of any help.
Steve
http://jsfiddle.net/iphipps/CLFBj/1/
Both the email and button inputs were being displayed as block and not floated or displayed inline. The code below worked for me.
#mc_embed_signup input.email{
display:inline-block;
}
#mc_embed_signup input.button {
display:inline-block;
}
Note: in the attached jsfiddle, I changed the display on both selectors, then added the code below after a comment. For some reason jsfiddle doesn't seem to like css cascaded overrides.
I have validation on all areas of a form, and within the inputs I have hints which are set in the input's Value.
However, the problem I have is that CodeIgniter see's the input as being filled in so a Validation error doesn't occur.
I know I can create a callback_function for each input, but with around 10 forms and 100 inputs I was hoping to avoid this and possibly create a generic function or rule?
Any help is greatly appreciated
You seem to be setting default values for your inputs when what you really want is a placeholder
So instead of this:
<input value="Enter your email" />
You want this:
<input placeholder="Enter your email" />
Depending on how you are setting up your input data, a single callback function could suffice if you really needed it, but really: Don't start hacking up Codeigniter for this. Just use placeholder as it was intended (see javascript solutions for older browsers).
Read more about it here:
http://diveintohtml5.ep.io/forms.html#placeholder
I am assuming what you mean is this:
Ghosted Values http://img864.imageshack.us/img864/8124/ghosted.png
Where the value in there is never meant to be the actual value?
The easy solution is to have a class on the <input> that indicates that it's using a stock input (and also it can grey the text out). When the user clicks in the field javascript can clear the initial value out for you (and remove the marker class).
You can then on the submit button click event go through the form and clear the values of anything with the marker class before you actually submit the form.