w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
HTML source field is also changing html code into escaped characters
Not sure I totally understand what you're saying, but try this to use the htmlEncode function as defined like this: function htmlEncode(value){ //create a in-memory div, set it's inner text(which jQuery automatically encodes) //then grab the encoded contents back out. The div never exists on the page. return $('<div/>').text(value).html(); } From HTML-encoding in JavaScript/jQuery

Categories : Javascript

What is the best way to store a field that supports markdown in my database when I need to render both HTML and "simple text" views?
You need to store your data in a canonical format. That is, in one true format within your database. It sounds like this format should be a text column that contains markdown. That answers the database-design part of your question. Then, depending on what format you need to export, you should take the canonical format and convert it to the required output format. This might be just outputting the markdown text, or running it through some sort of parser to remove the markdown or convert it to HTML.

Categories : Javascript

Generating PDF's or HTML emails using Backbone/Marionette views & models
The easiest way I found was by creating new or re-using existing templates (if suitable) and using the models to generate the html from compiled templates (underscore or handlebars). Using the existing view's el to capture dom elements is not a good idea as these many have additional classes attached if using jQuery or other frameworks. It is also possible to use multiple templates and append the result inside a div so complete representation of data can be produced in emailable or printable format. I created a div at the end of the doucment which is usually empty: <button id="email-itinerary">Email Details</button> ............ ............ ............ <div id="email-dialog"> </div> On clicking Email Details button, the handler for this button, uses c

Categories : Backbone Js

Compiling html templates using handlebars.js in backbone marionette CollectionView
Check out the Marionette documentation for the Renderer and TemplateCache. Between these two resources, you should be able to do this. I use Mustache personally, and overrode the methods specified in the documentation...and it works GREAT. First the Renderer: https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.renderer.md#custom-template-selection-and-rendering Basically, override the Renderer.render method. It will receive the template id (what you specify on your model, and the data). It should return the rendered template. And then the TemplateCache: https://github.com/marionettejs/backbone.marionette/blob/master/docs/marionette.templatecache.md#customizing-template-access The TemplateCache can be used to both retrieve the template, via loadTemplate and

Categories : Jquery

Router marionette backbone remove/rename base url (index.html)
That's a job for your server configuration: you need it to rewrite the routes with index.html to remove it but still perform the appropriate actions (e.g. using Apache's modrewrite, I believe).

Categories : Javascript

Hide an HTML form field when a button is clicked and replace it with a different field
This with jQuery might help. elmCount = 0; function addQual() { $("#Id." + elmCount).css('visibility', 'hidden'); $("#Id." + elmCount).css('height', '0px'); elmCount += 1; } Thanks to comments.

Categories : Javascript

HTML how to remove text in FileUpload field?
You can set the value of the image input to "" using jQuery to remove the selected file: $("#image").val("") See this fiddle: http://jsfiddle.net/nfvR9/1/ NOTE: This is dependent on browser used. It's works in FF 22 and Chrome 29.

Categories : Javascript

http:// in a text field crashes to 404 erorr - html
Unbelievable - it is common security practice to ban a list of keywords people may use as inputs for important fields. Username,email, name, and a lot of others all will receive instant warnings from the server. This is pre-code processing. To make the above code not give me an error I simply cannot use any string that contains username for my username input on my form. Thanks for looking if you tried.

Categories : HTML

How do I remove html tags and other characters from a text field
If your tag was correct, like so: <span>XL</span> instead of </span>XL</span>, strip_tags() should work for you. I verified with the following test... $text = "<span>XL</span>"; $goodtext = strip_tags($text); And output the results... echo htmlentities($text) echo "<br/>"; echo htmlentities($goodtext); Yielded... <span>XL</span> XL

Categories : PHP

Make a datepicker .html() object into a text field, not a span
Just turn then into input fields and use val() instead of .html() Markup <p id="day">Day of the week: <input name="day" type="text"></input> </p> <p id="month">Month: <input name="month" type="text"></input></p> <p id="date">Date: <input name="date" type="text"></input></p> <p id="year">Year: <input name="year" type="text"></input></p> Script $(".full_date").datepicker({ showOn: 'button', buttonText: 'Here', dateFormat: 'DD, dd MM yy', altFormat: "yy-mm", altField: ".year-month", onClose: function (dateText, picker) { // getDate returns a js Date object var dateObject = $(this).datepicker("getDate"); console.dir(dateObject); // Call D

Categories : Jquery

Get simple html text field to post to mysql database
You need the name="blahblah" attribute when submitting forms. On the PHP side, the name is how PHP receives the variable's "key" (var name) and then the field contents are the variable's value. On the HTML side: <input type="text" id="comment" name="myvarname" /> On the PHP side: <?php $comment = $_POST['myvarname'];

Categories : PHP

how to render data to select2 using backbone marionette js
I am able to do this : create model : var FetchMasters = Backbone.Model.extend({ url : Hexgen.getContextPath("/referencedata/portfolios") }); append the options like the below : var fetchMasters = new FetchMasters(); fetchMasters.fetch({ success : function() { for(var masterNum in fetchMasters.attributes) { $("#fund-code").append("<option>" + fetchMasters.attributes[masterNum].portfolio + "</option>"); } } }); $("#fund-code").select2({ placeholder: "Select Fund Code", allowClear: true });

Categories : Javascript

Adding to a HTML text field by clicking items in a multiple select box
You can see this fiddle : http://jsfiddle.net/ppSv4/ $('select option').on('click',function(){ $('#texthere').val( $(this).attr('value') ); });

Categories : Javascript

HTML input field does not save Text when pressing submit button?
When the site reloads the form is cleared. You have to fill it in by yourself. If you have an input field like this: <input type="text" name="test" id="test" /> You can do this: <input type="text" name="test" id="test" value="<?= isset($_POST['test']) ? $_POST['test'] : '' ?>" /> Another example with already set value: <input type="text" name="test2" id="test2" value="Hello" /> becomes: <input type="text" name="test2" id="test2" value="<?= isset($_POST['test2']) ? $_POST['test2'] : 'Hello' ?>" /> This checks if the POST Fields are set (that happens when the form was submitted) and then sets the form fields, else where empty or a default value. You can also epand this by additionally checking if the form was invalid and then fill the fields

Categories : PHP

How to put a button inside of a text entry field in a form on a website using javascript, css, html
Okay, let's start with jQuery, since it's more concise. $('form').each(function () { $(this).find('input').filter(':text').each(function () { $(this).after($('<button>').text('My Button')); }); }); http://jsfiddle.net/xERT8/2/ Edited for non-jquery version. Okay, here we go! var forms = document.getElementsByTagName('form'); for (var i = 0; i < forms.length; i++) { var form = forms[i]; var inputs = form.querySelectorAll("input[type=text]"); for (var j = 0; j < inputs.length; j++) { var input = inputs[j]; var button = document.createElement('button'); button.innerText = 'My Button'; input.parentNode.insertBefore(button, input.nextSibling); } } http://jsfiddle.net/53QQU/6/ Hope that helps.

Categories : Javascript

Asynchronous data filled in dropdown based on a text field : only HTML/Javascript
Never mind. I did it myself. Ofcourse google helped.. :D I'm putting it here in case anybody ever needs it. I've called a javascript method on onkeyup event of the TextField. Inside that function, I'm calling two other methods, one for adding up values to the dropdown, one for deleting all the dropdown values whenever they are required after checking the value of the TextField. Following are the methods for adding and deleting values :- function clearDropdownValues(selection) { var i; for(i=selection.options.length-1;i>=0;i--) { selection.remove(i); } } function addOptionToDropdown(selection, value, text ) { var optn = document.createElement("OPTION"); optn.text = text; optn.value = value; selection.options.add(optn); }

Categories : Javascript

How can I use javascript/jquery to prevent a decimal point from being typed into an HTML text field?
Use keypress event: http://jsfiddle.net/wAJp7/1 $('input').on('keyup', function (e) { if (e.which === 46) return false; }).on('input', function () { var self = this; setTimeout(function () { if (self.value.indexOf('.') != -1) self.value = parseInt(self.value, 10); }, 0); });

Categories : Javascript

Backbone Marionette: Don't render composite view if collection is empty
The answer ended up being to render the composite view after the fetch's deferred objected returned. initialize: function() { var self = this; this.collection = this.model.localFoods; this.collection.fetch().then(function() { self.render(); }); } Current score async:23, me:0 Async wins!

Categories : Backbone Js

how can i have a text field which have text in it and when the user clicks on the text field the text inside the field vanishes
You should use attrs parameter for form field widget like this: from django.forms import TextInput class CategoriesForm(ModelForm): class Meta: model = Categories widgets = { 'category_name': TextInput(attrs={'placeholder': 'PLACEHOLDER TEXT HERE'}) } Here is documentation

Categories : Python

backbone marionette compositeview doesn't render properly after collection sort
Here's a working example of your modified code : http://jsfiddle.net/AUZrY/1/ There were a few issues with your original code: your composite view didn't have a template (I changed it to a collection view) since you didn't have a template, there is nowhere for your appendHtml to attach child views you don't need to render views yourself with Marionette, especially replacing their html you had several models with the same id

Categories : Sorting

How to extract model from backbone collection on the basis of a field which is array of JSON
If you look at how where works: where: function(attrs, first) { if (_.isEmpty(attrs)) return first ? void 0 : []; return this[first ? 'find' : 'filter'](function(model) { for (var key in attrs) { if (attrs[key] !== model.get(key)) return false; } return true; }); } you'll see that it just scanning the models and comparing attributes using !==. When you using !== or === (or != or == for that matter) to compare arrays, the references are compared, not the content; for example, this is false: [1] === [1] The result is that searching for an array using where doesn't work that well, where is meant to be a shortcut for searching for simple scalar values. If you need to search for an array, then you can use filter directly and you can use _.isEqual to help you compa

Categories : Javascript

Populate file contents in value field of a text box
If you problem is related to the file you load having special characters in to that html/javascript does not like try this $final1 = htmlspecialchars( file_get_contents(FILENAME) ); echo '<script> document.getElementById("textbox").value = "'.$final1.'";</script>';

Categories : PHP

Putting contents from a text field in one view to an array in another
You should create an NSMutableArray and add the text field value to every time AddTransactionViewController is dismissed. Once you have the array ready, display it in the table view as you normally would. I'd also recommend you check out the free Sensible TableView framework. Should save you tons of time with collecting data and automatically displaying your arrays in table views.

Categories : IOS

Setting Backbone Marionette model via Global Object
Backbone allows you to populate a Backbone collection either as you have (with an empty constructor) or with a collection of data. It sounds like you've already got the data stored in the User object, and you want to push this information to the Entities.Access collection. var access = new Entities.Access(user.access); I'm with you, this feels a bit like a hack, but since Backbone doesn't support this nativly there isn't much else you can do. Have a look at Backbone-Relational or supermodel.js. These projects provide better forms of model nesting than the default implementation.

Categories : Javascript

Marionette CollectionView re-render when a model is removed from the collection
Backbone.View defines a method called remove that removes a view from the DOM. Your first example overrides that method. If you rename remove to something like removeIt the name collision disappears and the code works as expected. For what it's worth, I think the second approach is preferable for this type of situation anyway.

Categories : Backbone Js

Changing the contents of a text field on change of a dropdown menu
instead of using data() ,try getting the selected value using val() $('#stock1').change(function() { $('#stock1T').val($('#stock1 option:selected').val()); });

Categories : Jquery

How do I remove the html tags from rails_admin/ckeditor so that field content does not contain html tags?
So, as far as I could gather, you want to display the actual unescaped HTML. <%= raw post.content %> Reference: raw (ActionView::Helpers::OutputSafetyHelper) - APIdock

Categories : Ruby On Rails

Backbone Marionette - trying to update one model in a collection deletes the other models
You need add({row}, {index: n}) to insert a row in the collection (or add({row}) if you don't care about the position of the new row), but you must know which row to remove, so you can call remove({oldrow}). You can find out the index for the add call with _.indexOf(collection, {row}); If the add&row is not good enough, then you have to update the object in the collection and not replace it. Links: http://underscorejs.org/#indexOf http://backbonejs.org/#Collection-add

Categories : Backbone Js

How to load html contents from stream and then how to create style sheet to display the html file in preview pane (like HTML preview handler)
You mean you want to make HTML Browser inside a window? please take a look at this link. http://www.codeproject.com/Articles/3365/Embed-an-HTML-control-in-your-own-window-using-pla if this isnt what you want, please explain what you mean by "preview handler for HTML"

Categories : C++

For mobile browser when a text field is in focus how do I "push" the text field to the top of the page instead of the default middle?
$(document).on('focus click', 'input', function() { if($(window).width() <= 767) { $('html, body').animate({ scrollTop: $('input').offset().top }, 'fast'); } }); Got it to work but there's a little stutter as .animate() fires after iPhone's own centering. Improvements welcome.

Categories : Javascript

How Can we Render Html text in DataGridView?
In the mark-up (please note the Mode is PassThrough): <asp:GridView ID="GridView1" runat="server"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:Literal ID="literal1" Mode="PassThrough" runat="server"></asp:Literal> </ItemTemplate> </asp:TemplateField> </Columns> Use the RowDataBound event to find the literal and set the value: void GridView1GridView_RowDataBound(Object sender, GridViewRowEventArgs e) { if(e.Row.RowType == DataControlRowType.DataRow) { //find the literal var literal1 = e.Item.FindControl("literal1") as Literal; if (literal1 != null) { literal1.Text = "<p>hi some text here</p>"; } } } Please forgive any errors, I have not tested the abov

Categories : C#

Django - How to fill modelform field from database when field not in model?
You need the data instead of initial You can try this: if request.POST: formset = StudentScheduleFormSet(request.POST,) for form in formset: if not form.data['course_term']: form_obj.course_term = CourseTerm.objects.get(course=form.cleaned_data['course'], term=form.cleaned_data['term']) if form.is_valid(): form.save() if formset.is_valid(): formset.save() OR if request.POST: formset = StudentScheduleFormSet(request.POST,) for form in formset: if form.is_valid(): if not form.cleaned_data.get('course_term'): form_obj = form.save(commit=False) form_obj.course_term = CourseTerm.objects.get(course=form.cleaned_dat

Categories : Django

generating a text field dynamically on clicking previous text field using javascript
It seems like you only want the handler on input.XYZ but you are adding it to everything in $node. Instead of $node.one( ... Do this $node.find("input.XYZ").one( ...

Categories : Javascript

How to create spaced text fields with a description of the text field at the top of each text field
hope the following code will help you, You have to place TextView in between EditText to give reference, <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".AddContact" > <TextView android:id="@+id/lbl_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="User Name" /> <EditText android:id="@+id/edit_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="Enter name" > </EditText> <TextView a

Categories : Android

How can I enter text and render the html using angularjs?
Version that works in angular < 1.2 http://jsfiddle.net/AQWAR/ The HTML <div ng-app="myapp"> <form> <input type="text" ng-model="ddata"/> </form> {{ddata}} <div ng-bind-html-unsafe='ddata'> </div> </div> The JS angular.module("myapp", []); Version that works in Angular > 1.2 (specifically tested with 1.2.1) http://jsfiddle.net/AQWAR/1/ HTML <div ng-app="myapp" ng-controller="MyCtrl"> <form> <input type="text" ng-model="ddata.someString"/> </form> {{ddata}} <div ng-bind-html='ddata.trustedVersion'> </div> </div> The JS angular.module("myapp", []).controller("MyCtrl", ["$scope","$sce", function($scope, $sce){ $scope.ddata = {someString:"", trustedVersion:""} $scope.$watch("d

Categories : Javascript

Override Marionette.Region's getEl method in Backbone.Marionette
Here's my understanding of this: the points below apply to the case where the layout is contained within another element ("if we have a parentEl") the first time you use a region, Marionette needs to select the proper DOM element to populate, according to the selector string ("ensure the selector is found on the first use of the region") you can't simply look for the selector in the parentEl ("if we try to assign the region's el to parentEl.find(selector) in the object literal"), because the DOM element we want isn't necessarily in the DOM yet ("the element will not be guaranteed to be in the DOM already") In other words, the first time you use a region (e.g. with a call to the show method), Marionette needs to build a region instance and associate it with the correct DOM element (spec

Categories : Javascript

Show escaped html tags from XML as well as non-escaped tags in XSLT
Well use <xsl:template match="li"> <xsl:copy> <xsl:value-of select="." disable-output-escaping="yes"/> </xsl:copy> </xsl:template> of course with other templates for ancestors of li generating a ol or ul as needed and processing child elements e.g. <xsl:template match="test"> <ul> <xsl:apply-templates/> </ul> </xsl:template> But disable-output-escaping is not supported for instance for client-side XSLT in Mozilla browsers. And generally XSLT processors do not need to support it.

Categories : HTML

how to store and retrieve the HTML text Editor contents to SQL Server DB in ASP.net C#
You can use HtmlEncode & HtmlDecode: // Encode the content for storing in Sql server. string htmlEncoded = WebUtility.HtmlEncode(text); // Decode the content for showing on Web page. string original = WebUtility.HtmlDecode(htmlEncoded);

Categories : C#

render html in a rich text box in active reports software
The actual property you are looking for is the Html Property. You can also load a file into that control using the step-by-step walkthrough here. I am assuming you are using Section Reports and not Page Reports. To use HTML from the database in a bound report, you should be able to use the DataField property of the RichTextBox control (set it to the name of the corresponding Data field at design time). However, I noticed this "Render HTML tags in DB in ActiveReport pdf or HTML" article which kind of implies that doesn't work since it loads the HTML from a database programatically. One of the two should work.

Categories : Misc

Selected field is blank when fetches a Backbone collection with Backbone-forms
Look at the example http://jsfiddle.net/evilcelery/dW2Qu/ var user = new User({ title: 'Mr', name: 'Sterling Archer', email: 'sterling@isis.com', birthday: new Date(1978, 6, 12), password: 'dangerzone', notes: [ 'Buy new turtleneck', 'Call Woodhouse', 'Buy booze' ] }); These are the defaults. In your case you would use something similar to var options = new App.Collection.Tags; class foo extends Backbone.Model schema: tag: type: 'select' options: options for (first in options) break; var Foo = new foo({tag:first});

Categories : Backbone Js



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.