select

Rails select list reverts to top?

Hi Everyone, I have number of select lists in my rails application like this: <li>Company<span><%= f.select :company_id, Company.all.collect {|m| [m.companyname, m.id]} %></span></li> They all work well, except - sometimes if you go to the edit view, the select list reverts to the top item, not the item that was chosen when creating...

document.getElementById('').length = 0 doesn't work under Win7

I have a select list: <select id="sel"> <option>text1</option> <option>text2</option> <option>text3</option> <option>text4</option> </select> I want to delete all items, without for loop. I tried: document.getElementById('sel').length = 0; But this doesn't work in some browsers. Any ideas? Thanks ...

Jquery .select function for selecting inside of select menus?

I have a select menu with two options that are settings for my website. Instead of having a save button, I want it to save to the db when the new value is selected. Right now I have setup a .click function in my jquery file that achieves this purpose for the most part. The only problem is that if you click the drop down arrow (like click...

How can i get the selected option name or id of a select element using jQuery

Hi All, i have a "questionairre" that is made up of a series of select boxes. i need to use two properties in the options. For each selected option i need the value (which i know how to get and is working fine) but i also need to store an additional value which represents the id of the specific option in a DB. One solution would be to ...

PHP mySQL - select unique value that not being used from dirrefent table

Updates : Please see below i have table: data +-----------------------+--------------+-----------+ | State | d_country | d_postcode| +-----------------------+--------------+-----------+ | State1 | Country1 | 1111 | | State2 | Country2 | 2222 | | State3 ...

MYSQL select query where multiple conditions in same column must exist

I'm putting together a dating site and I'm having a mysql query issue. This works: SELECT * FROM `user` , `desired_partner` , `user_personality` WHERE dob BETWEEN '1957-05-18' AND '1988-05-18' AND country_id = '190' AND user.gender_id = '1' AND user.user_id = desired_partner.user_id AND desired_partner.gender_id = '2' A...

Line Break in Html Select Option?

Can I have a two line text in an html select option? How? ...

Rails date select options?

Hi Everyone, I have a date_select field in my rails application as follows: <%= f.date_select :dateinstructed %> I would like to re-order the drop down lists show they output as: DD/MM/YYYY According to what I have read you can use the :order option, but I am unsure how to actually use this option: <%= f.date_select :dateinstruc...

How to differenciate the data when doing a UNION on 2 SELECTS ?

If I have the following two tables : Employes Bob Gina John Customers Sandra Pete Mom I will do a UNION for having : Everyone Bob Gina John Sandra Pete Mom The question is : In my result, how can I creat a dumn column of differenciate the data from my tables ? Everyone Bob (Emp) Gina (Emp) John (Emp Sandra (Cus) Pete (Cu...

jQuery - disable selected options

Need to disable already selected options in select box using jQuery. I'd like it to grey out like asmselect. Test my example here. //JS $("#theSelect").change(function(){ var value = $("#theSelect option:selected").val(); var theDiv = $(".is" + value); theDiv.slideDown().removeClass("hidden"); }); $("div a.remove").c...

SQL select from last inserted

Hello, in MySQL, I have table. One column has auto-increment. When I insert something mysql_query('INSERT INTO `table` SET `column` = "data";'); Now, what I want is, without further queries, to get the value of the auto-incrementing column, maybe like this: mysql_query('insertion = (INSERT INTO `table` SET `column` = "data"); SELEC...

How do I perform a dynamic select in Linq?

I am trying to figure out how to dynamically specify the properties for my select clause in a linq query. Lets say I have a collection of employee objects. At run time, the end user will be specifying which properties they would like to see for those employees, so I need to be able to dynamically construct my Linq select clause. I h...

select rows with unidentical column values using R

Hi Guys, I need to create a new data frame that excludes dams that appear in "dam1" and "dam2" columns on the same fosdate (fostering date). I tried df <- df[df$dam1!=df$dam2,] but did not work. Dam1 and dam2 are factors which are the id's of mothers. my df: fosdate dam1 dam2 8/09/2009 2Z523 2Z523 30/10/2009 1W509 ...

Can't access form elements

Hi, my problem is that my variables are not working in javascript. all variables need names without some character at the beginning, this is the stupid thing...Anyways, im trying to make a funtion that makes "select all checkboxes". It is not working so i looked at the page source/info and found out that the variables were not changing. ...

SQLite Select an id which is smaller than a number

Hi, I am trying to only select the objects where the id is smaller than an int value. e.g.: i have 3 objects -> id = 1, id = 2, id = 3 Now I want to only get the objects with the id smaller than the variable i = 2; How can I manage this? sql = "SELECT id FROM table_name WHERE id <= i"; Thanks ;-) ...

Select multiple unique lines in MySQL

Hi, I've got a table with the following columns: ID, sysid, x, y, z, timereceived ID is a unique number for each row. sysid is an ID number for a specific device (about 100 different of these) x, y and z is data received from the device. (totally random numbers) timereceived is a timestamp for when the data was received. I need a ...

Oracle SELECT query: collapsing null values when pairing up dates

I have the following Oracle query: SELECT id, DECODE(state, 'Open', state_in, NULL) AS open_in, DECODE(state, 'Not Open', state_in, NULL) AS open_out, FROM ( SELECT id, CASE WHEN state = 'Open' THEN 'Open' ELSE 'Not Open' END AS state, T...

select multiple columns using linq and sum them up

Hi, How can i select multiple columns and calculate the total amount. For example, in my database i got a few fields which are named: 5hunderedBills, 2hunderedBills, 1hunderedBills, etc. And the value of those fields are for example: 5, 2, 3 And the sum would be: 5hunderedBills * 5 + 2hunderedBills * 2 + 1hunderedBills * 3 How ca...

How to get unique value in jQuery?

I am learning jQuery. I have the following chunk of code in an HTML file: <table width="100%"> <tr> <td align='center'> <div> <a id='get_this' href='#'> <input type='hidden' id='id' value='1'><img src='images/1.gif'></a> </div> </td> <td align='center'> <div> <a id...

How to display different value in struts 2 select

Hi, I'm new to this. I want to know how to display a different value in struts 2 select. eg: i want to put Jan,Feb as month where the value should pass 1,2 respectively. if anybody aware of this please let me know thank you. ...