Instead of explicitly using a Some, as suggested by @hezamu, you could use the apply method on the Option companion like so: val maybeADate:Option[Date] = Option(aDate) In this case, in the off chance that aDate was null, then your Option would be a None instead of Some(null) which would be...

Create your select options in a loop, and in each iteration check if the current value equals the one you get from the page get variable. For brevity i have used the ternary operator in this example: <?php $pageno = isset($_GET['page'])?$_GET['page']:''; ?> <select name='Bday' id='Bday' > <?php for($i=1;$i<=31;$i++):?> <option value="<?php...

There is a function in geoxml3 to parse out the text content of an HTML element: //nodeValue: Extract the text value of a DOM node, with leading and trailing whitespace trimmed // from geoxml3: https://code.google.com/p/geoxml3/source/browse/branches/polys/geoxml3.js function nodeValue(node, defVal) { var retStr=""; if (!node) { return (typeof defVal === 'undefined' ||...

You'll need to change: if($menuLabel == $_POST['Menu']){ $Selected = 'selected'; } to be $menuId instead of $menuLabel because the render function is outputting the values of the ID instead of the label to the options. Something like this should do what you need: foreach($this->menuIDs as $menuID){ if (isset($_POST['Menu'])){ if($menuID== $_POST['Menu']){...

I need to perform a query/map operation where I convert a nullable field to None if it contains a certain non-null value Given the example data you have in the update, and pretending that 1 is the "certain" value you care about, I believe this is the output you...

You don't have a closing tag for <option> , rather you have 2 opening tags each time. This is causing your invalid markup. Change both closing tags to </option> In other words: <option><option> Should be <option></option> ...

I don't know that plugin, but looking at the examples there seems to be one that fits your need; Example 6 - AJAX lazy loading & setting value on each level change. This would, in theory, just require some config options: preselect: {'demo6': ['220','226']}, // array of default values -...

... is not a valid Scala expression. If you want a function with an "unknown" implementation you can use ???: def option[A, X](o: Option[A])(none: => X, some: => A => X): X = ??? The goal of this function is apparently to take a function as parameter and to apply...

Try with this if you want to update as per your code: jQuery(document).ready(function($) { // pass the $ as arg in the callback var $select = $(".listing-search-min.select[name='min']"); $select .find('option') .remove(); $select .append('<option value="whatever">text</option>'); }); Issues with your code: $(".listing-search-min select[name='min']") // this selector is wrong due to space .find('option') .remove()...

Optionality is an orthogonal concern to what type your data is. So yes, Option[Boolean] makes just as much sense as say Option[Int]. Let's talk about your particular use case. If the business rule says the field (say) isPrimeTime has to be of type Boolean, but is optional, then you should...

For option we should not use name there we are only supposed to give value name has to give in the select tag For example <select name="xxx"> <option value="1">one</option> <option value="2">Two</option> <option value="3">Three</option> </select> Sure this will helps you...

A one-line explanation would probably be that the second option specifies something about how the first one works. Link Library Dependencies set to Yes: if the solution is set up so that the current project has a dependency on another project that produces a .lib file, then that file will...

Your note in PS has the right idea. There is no way to prevent people from tampering with the data in their browser. One has to act accordingly, every piece of data coming back from the client is untrusted and should be validated where possible.

To be clear, the -e option checks for both file and directory (symbolic links included). The condition [ ! -e /tmp/.wm_ready ] checks that there isn't any file or directory or symbolic link exists by the name .wm_ready in tmp folder...

First of all, use of <% scriptlets %> is deprecated in JSPs so consider switching to JSP EL. I've used the same to show how simple its use is. To retrieve price in the other JSP, you have to pass it too. Currently, your <select> displays both name and price,...

The notion of hidden options in a select doesn't exist in IE. You would have to manually remove and re-add the entries, which may be somewhat of an inconvenience. Another solution would be to also disable the elements $("input:radio").on('change click',function(){ $("select#typeDeProduit > option").hide().prop('disabled', false); cacherTousTypesDeProduit(); rafraichirListeTypeDeProduit(); }); function cacherTousTypesDeProduit(){ $("select#typeDeProduit...

You can use .remove() to completely remove element from DOM. $("#Month option[value='whatever']").remove(); EDIT $("#Month option[value='whatever']").hide(); and you can later get them back by $("#Month option[value='whatever']").show(); ...

You need to select 1st option by default on ng-init="MyCtrl.selectedCargo=MyCtrl.cargoList[0].name" & ng-model name should not be same as that of your cargoList. Markup <select ng-model="MyCtrl.selectedCargo" ng-init="MyCtrl.selectedCargo=MyCtrl.cargoList[0].name"> <option ng-repeat="cargo in MyCtrl.cargoList" value="cargo.name">{{ cargo.name }}</option> </select> Demo Plunkr...

You just need to make following changes in the same fiddle. And it will work for you. Notice that I have added this.choice.subscribe() this function will monitor change made in selection of dropdown function ViewModel(choices, choice) { this.choices = ko.observableArray(choices); this.choice = ko.observable(this.choices.find("id", choice)); this.choice.subscribe(function(newValue){ alert(newValue.id); }) }; http://jsfiddle.net/Dnyanesh/L0vL7zLu/4/...

I overrode original xenforo node model and option. The option just needs to be changed to call the new model, and the model needed the selected to check if the nodeid was in the value array. public static function getNodeOptions($selectedForum, $includeRoot = false, $filter = false) { /* @var $nodeModel...

You can't have php code inside a variable in php code. What you should do is to escape the string and then concatenate. <option value="4" '. (($_POST['news']=="4") ? "selected=selected" : "") .'>Show news from the last 4 weeks</option> <option value="6" '. (($_POST['news']=="6") ? "selected=selected" : "") .'>Show news from the...

Your insert function takes option<Tree<'T>> but returns Tree<'T>. When performing the fold, you need to keep state of the same type - so if you want to use None to represent empty tree, the state needs to be optional type. The way to fix this is to wrap the result...

Unfortunately your POST can only post the value of the input. The way this case is typically address however, is by defining these value-display text relationships in code. So you may have an array defined in PHP like this: $damage_options = array( '100 Euro' => 'Exhaust', '200 Euro' => 'Brakes'...

Your specific questions are difficult to address because it's unclear exactly what you're trying to achieve. In particular, when you ask what the purpose of the try block is... Well, you wrote it, so only you can answer that. In general, you never call get on an Option. You either...

The .fitBounds method resets the viewport and thus your zoom level is not taken in account. Here is a minimal working example: https://jsfiddle.net/pdnsown1/1/. If you comment the line containing the call to .fitBounds and change the zoom level, you will see that it is actually applied. However, if you leave...

So, putting <span> inside of an option actually violates the HTML spec (It is bad to put <span /> tags inside <option /> tags, only for string manipulation not styling?), so depending on the user's browser, the spans may not even be present in the dom (replaced instead with a...

pidof thinks that --play is its option, and that is of course an error. It would be better to check if --play is inside the commandline that was used to start amarok: grep -- --play /proc/$(pidof amarok)/cmdline Another option is to grep output of ps aux: ps aux | grep...

If the intent is to find the first occurence of value1 (if it exists) this would do the trick: object MaintenanceRequest { def apply(path: String, value1: Int): Option[Example] = // get all lines Source.fromFile(path).getLines() // find the first line that matches value1 .find(_.replaceAll(" ", "").startsWith(value1 + ";")) // map over...

I managed to fix the problem myself. Apparently for JQuery mobile you need to refresh the list, but standard JQuery you don't need to. Here's the solution (where #problem is the ID of the select menu): $("#problem").selectmenu("refresh"); Hope this helps anyone that have this problem. ...

Looks like there are a few mistakes in the code you posted. There are a few simple errors like spelling and a missing $ inside the event handler. Also the way you're getting the value of the dropdown can be simplified. Here's an example. <html> <head> <meta http-equiv="content-type" content="text/html" />...

Define the case class so that the second member is a var: case class Stuff(name: String, var value: Option[String]) Now you can create an instance of Stuff and modify the second value: val s = Stuff("bashan", None) s.value = Some("hello") However, making case classes mutable is probably not a good...

Here are some pointers: You do not need to give each button a unique class. Use their relative position within the group of button to determine the corresponding option to select. $("select[name='category_id']").eq(3).prop('selected', true); does not mean much; the selected property belongs with the option element. Once you change the selected...

You cannot have Multiple values in an Option Tag. If the Name of the Front and Back-Image only differ by the Page-number, you can use this code: function selectFlyer(name){ selectFront(name+"pag1.png"); selectBack(name+"pag2.png"); } function selectFront(imgSrc) { loadImage(imgSrc); var Dim_Slice = document.querySelectorAll(".slice"); for (var i = 0; i < Dim_Slice.length; i++) {...

I had a similar problem I hope this may help. You want to apply f to the value currently in the option. In this case you need to return a new option containing a copy of the value in 'this' option. template<typename T> template<typename Function> Option<T> Option<T>::filter( Function f )const{...