Page 2 of 2

saving current selected option from a 'select menu' component to a local storage variable?

Posted: Mon Oct 08, 2012 12:14 am
by Jersey Customs Web & Game Creations

var jQT = $.jQTouch({
});

var db;
$(document).ready(function(){
$('#createProfile1 form').submit(saveJob1);
$('#createProfile1').bind('pageAnimationStart', loadJob1);
}

var shortName = 'FirstJob';
var version = '1.0';
var displayName = 'FirstJob';
var maxSize = 65536;
db = openDatabase(shortName, version, displayName, maxSize);
db.transaction(
function(transaction) {
transaction.executeSql(
'CREATE TABLE IF NOT EXISTS entries ' +
' (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, ' +
' date DATE NOT NULL, choices TEXT NOT NULL );'
);
}
);

function loadJob1() {
$('#FullPart1').val(localStorage.FullPart1);
}
function saveJob1() {
localStorage.FullPart1 = $('#FullPart1').val();
}

There are more values I omitted but that is the basics.


saving current selected option from a 'select menu' component to a local storage variable?

Posted: Mon Oct 08, 2012 1:12 am
by maxkatz

And FullPart1 is a drop down list?


saving current selected option from a 'select menu' component to a local storage variable?

Posted: Mon Oct 08, 2012 1:18 am
by Jersey Customs Web & Game Creations

oh yeah sorry


saving current selected option from a 'select menu' component to a local storage variable?

Posted: Mon Oct 08, 2012 1:21 am
by Jersey Customs Web & Game Creations

here is the page.

Your Jobs

Code: Select all

 a class="button" href="#editJobs" rel="nofollow"Cancel/a 

 ul class="rounded" 
   li 

   /li 
   li 

   /li 
   li 

   /li 
   li 

   /li 
   /ul
   

       Select Rate 
       Hour 
       Day 
       Week 
       By-Weekly 
       Monthly 
       Salery 

       Select Rate 
       Hour 
       Day 
       Week 
       By-Weekly 
       Monthly 
       Salery 

   Started Job: 
     
       Month 
       January 
       February 
       March 
       April 
       May 
       June 
       July 
       August 
       September 
       October 
       November 
       December 

       Day 
       1 
       2 
       3 
       4 
       5 
       6 
       7 
       8 
       9 
       10 
       11 
       12 
       13 
       14 
       15 
       16 
       17 
       18 
       19 
       20 
       21 
       22 
       23 
       24 
       25 
       26 
       27 
       28 
       29 
       30 
       31 

       Year 
       2012 
       2011 
       2010 
       2009 
       2008 
       2007 
       2006 
       2005 
       2004 
       2003 
       2002 
       2001 
       2000 
       1999 
       1998 
       1997 
       1996 
       1995 
       1994 
       1993 
       1992 
       1991 
       1990 
       1989 
       1988 
       1987 
       1986 
       1985 
       1984 
       1983 
       1982 
       1981 
       1980 
       1979 
       1978 
       1977 
       1976 
       1975 
       1974 
       1973 
       1972 
       1971 
       1970 
       1969 
       1968 
       1967 
       1966 
       1965 
       1964 
       1963 
       1962 
       1961 
       1960 
       1959 
       1958 
       1957 
       1956 
       1955 
       1954 
       1953 
       1952 
       1951 
       1950 
       1949 
       1948 
       1947 
       1946 
       1945 
       1944 
       1943 
       1942 
       1941 
       1940 
       1939 
       1938 
       1937 
       1936 
       1935 
       1934 
       1933 
       1932 
       1931 
       1930 
       1929 
       1928 
       1927 
       1926 
       1925 
       1924 
       1923 
       1922 
       1921 
       1920 

   Left Job: 
     
       Month 
       January 
       February 
       March 
       April 
       May 
       June 
       July 
       August 
       September 
       October 
       November 
       December 

       Day 
       1 
       2 
       3 
       4 
       5 
       6 
       7 
       8 
       9 
       10 
       11 
       12 
       13 
       14 
       15 
       16 
       17 
       18 
       19 
       20 
       21 
       22 
       23 
       24 
       25 
       26 
       27 
       28 
       29 
       30 
       31 

       Year 
       2012 
       2011 
       2010 
       2009 
       2008 
       2007 
       2006 
       2005 
       2004 
       2003 
       2002 
       2001 
       2000 
       1999 
       1998 
       1997 
       1996 
       1995 
       1994 
       1993 
       1992 
       1991 
       1990 
       1989 
       1988 
       1987 
       1986 
       1985 
       1984 
       1983 
       1982 
       1981 
       1980 
       1979 
       1978 
       1977 
       1976 
       1975 
       1974 
       1973 
       1972 
       1971 
       1970 
       1969 
       1968 
       1967 
       1966 
       1965 
       1964 
       1963 
       1962 
       1961 
       1960 
       1959 
       1958 
       1957 
       1956 
       1955 
       1954 
       1953 
       1952 
       1951 
       1950 
       1949 
       1948 
       1947 
       1946 
       1945 
       1944 
       1943 
       1942 
       1941 
       1940 
       1939 
       1938 
       1937 
       1936 
       1935 
       1934 
       1933 
       1932 
       1931 
       1930 
       1929 
       1928 
       1927 
       1926 
       1925 
       1924 
       1923 
       1922 
       1921 
       1920 

       F/T or P/T 
       Full Time 
       Part Time

saving current selected option from a 'select menu' component to a local storage variable?

Posted: Mon Oct 08, 2012 1:22 am
by Jersey Customs Web & Game Creations

F/T or P/T
Full Time
Part Time


saving current selected option from a 'select menu' component to a local storage variable?

Posted: Mon Oct 08, 2012 1:24 am
by Jersey Customs Web & Game Creations

Here is the code I removed all the < brackets so it would show

li
select name="FullPart1" id="FullPart1" style="width:45%;"
option value="FullPart"F/T or P/T
option value="Full"Full Time
option value="Part"Part Time
/select
input placeholder="Avg. Hrs Worked" name="AvgHrs1" id="AvgHrs1" type="text" style="width:50%; "
/li


saving current selected option from a 'select menu' component to a local storage variable?

Posted: Mon Oct 08, 2012 3:53 am
by maxkatz

Same code in Tiggzi builder.

Saving:
code
localStorage&#46;selectedPhone = Tiggzi('phones')&#46;val();
/code

Getting the value:
code
Tiggzi('phones')&#46;val(localStorage&#46;selectedPhone);
Tiggzi('phones')&#46;selectmenu('refresh');
/code

Tiggzi('id') is just a shortcut to:
code
$('select[dsid="phones"]')
/code

You can always use jQuery directly.

My drop down component name (id) is "phones".