methuselah90 Newbie Poster

I would like to update a variable and array item after a record array search, and wanted to know what would be the best way of carrying it out in Javascript.

In this case, if a match is found between the variable and area item, then the postcode item should be appended to the variable.

The same needs to be done for the array items, but I reckon that a for loop would work best in this scenario, as each individual item would need to be accessed somehow.

Btw due to the nature of my program, there will always be a match. Furthermore, I need to be able to distinguish between the singleAddress and multipleAddresses variables.

Hopefully this code explains things better:

// before search 
var singleAddress = "Mount Farm";
var multipleAddresses = ["Elfield Park", "Far Bletchley", "Medbourne", "Brickfields"];

// this is the record which the search needs to be run against
plot = [{
    postcode: "MK1",
    area: "Denbigh, Mount Farm",
}, {
    postcode: "MK2",
    area: "Brickfields, Central Bletchley, Fenny Stratford, Water Eaton"
}, {
    postcode: "MK3",
    area: "Church Green, Far Bletchley, Old Bletchley, West Bletchley",
}, {
    postcode: "MK4",
    area: "Emerson Valley, Furzton, Kingsmead, Shenley Brook End, Snelshall West, Tattenhoe, Tattenhoe Park, Westcroft, Whaddon, Woodhill",
}, {
    postcode: "MK5",
    area: "Crownhill, Elfield Park, Grange Farm, Oakhill, Knowlhill, Loughton, Medbourne, Shenley Brook End, Shenley Church End, Shenley Lodge, Shenley Wood",
}]

// after search is run then:
// var singleAddress = "Mount Farm, MK1"
// var multipleAddresses = ["Elfield Park, ...

methuselah90

Sorry it should say - line up "Back" text with heading

methuselah90 Newbie Poster

What would be the best way of lining up the Back text with the Booking heading?

HTML

<nav class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    <div class="navbar-brand">Booking</div>
    <div>Back</div>
  </div>
</nav>

CSS

.navbar {
    background-color: #0088CC;
    padding-left: 0em !important;
    padding-right: 0em !important;
}
.navbar-brand {
    color: #fff !important;
    padding-left: 0em !important;
    padding-right: 0em !important;
    text-align: center;
    margin: 0 auto !important;
    width: 100%;
    display: inline !important;
}
nav > .container {
    width: 100%;
}

Fiddle here

methuselah90 Newbie Poster

Twitter Typeahead only seems works with elements called when the page loads (and not the dynamically created stuff made by methods like addWaypoint). How would I resolve this? Please find my code below:

$(document).ready(function () {
    // Add waypoints
    $('#add-waypoint-button').click(function () {
        var n = $('#waypoints input').length;
        addWaypoint(n);
    });

    // Address lookup
    addressLookup();
});

function addWaypoint(waypointCount)
{
    if(waypointCount < 4) {
        $('#waypoints-page #waypoints').append('<div class="waypoint-container"><input type="text" class="form-control booking waypoint" placeholder="Via"><label class="remove-waypoint-button" for=""><i class="fa fa-times"></i></label><hr></div>');
        if ($(window).height() <= 568) {
                $('.form-control').removeClass('input-sm');
                $('.form-control').removeClass('input-lg'); 
                $('.form-control').addClass('input-sm');
            }
            else {
                $('.form-control').removeClass('input-sm');
                $('.form-control').removeClass('input-lg'); 
                $('.form-control').addClass('input-lg');
            }
        }
}

function addressLookup() {
    // Instantiate the Bloodhound suggestion engine
    var addressLookup = new Bloodhound({
        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        limit: 5,
        prefetch: {
            url: 'assets/data/countries.json',
            filter: function (list) {
                // Map the remote source JSON array to a JavaScript object array
                return $.map(list, function (addressLookup) {
                    return {
                        name: addressLookup
                    };
                });
            }
        }
    }); 
    // Initialize the Bloodhound suggestion engine
    addressLookup.initialize(); 
    // Instantiate the Typeahead UI
    $('.book-journey-container #pickup, .book-journey-container #destination, .waypoint-container .waypoint').typeahead(null, {
        name: 'addressLookup',
        displayKey: 'name',
        source: addressLookup.ttAdapter()
    });
}

methuselah90 Newbie Poster

I have 2 spreadsheets - uat.xlsx and main.xlsx - both in the same directory.

main.xlsx

[Click Here](null)

uat.xlsx

Click Here

I am trying to copy across information from uat.xlsx to main.xlsx, by accomplishing the following in VBA (the VBA code will be stored on main.xlsx and launched by button click):

If column A in main.xlsx matches column B in uat.xlsx, then check to see if there is anything in column J-Lin main.xlsx matches anything in column A on uat.xlsx for the user found, if these two conditions are met then:

on the matching row in main.xlsx, update column M on main.xlsx with "Yes"

once this is done, grab the first 10 characters of column D in uat.xlsx, then on the same matching row on main.xlsx, update column Q with the values

once this is done, check column C in uat.xlsx, if the value is "I already have", then on the same matching row on main.xlsx, update column N with "Physical", if the value is "Required", then on the same matching row on main.xlsx, , update column N with "Virtual"

This only needs to happen once per match - ignore any duplicate matches on uat.xlsx (i.e. on a new row)

Secondly - I need to eliminate any differences in "case" by making standardising all the values checked to either lowercase/uppercase.

How would I articulate this as VBA code?

methuselah90 Newbie Poster

I'm currently pulling out information from column B in an Excel worksheet + the worksheet name.

How would I go about pulling information from column J (which has the same start row/end row as the information pulled out from column B) in the same worksheet and assigning it to the object property $apps.location? I've done a bit of research on the internet, but there doesn't seem to be a straightforward method of accomplishing this.

$(for ($i=3; $i -le $wb.sheets.count; $i++){

    $sh=$wb.Sheets.Item($i)
    $startCell_appname = $sh.cells.item(1,2).EntireColumn.find("Application Name").Address()
    $startCell_appname = [regex]::replace($startCell_appname, '(\$\w+\$)(\d+)', {param($m) $m.groups[1].value + ([int]$m.groups[2].value+1)})    
    $endCell_appname = $sh.cells.item(1,2).EntireColumn.find("").Address()
    $endCell_appname = [regex]::replace($endCell_appname, '(\$\w+\$)(\d+)', {param($m) $m.groups[1].value + ([int]$m.groups[2].value-1)}) 

    $rangeAddr=$startCell_appname + ":" + $endCell_appname
    $sh.Range($rangeAddr).Value2 |
      foreach {
        $apps = "" | Select appname,location,lob,os
        $apps.appname = $_ 
        $apps.location = ""   
        $apps.lob = $sh.Name
        $apps.os = "Windows 7"
        $apps
      } 
}) | Export-csv "apps.csv" -NoTypeInformation

methuselah90 Newbie Poster

What would be the best way of formatting the DIV below so that it works on all browsers (i.e. Google Chrome, Safari, IE, Firefox)?

It currently looks alright in Chrome but does not look very good in Firefox or IE!

I would like the numbers centred in the middle of the circle and the line passing through it.

Here is my code below: http://jsfiddle.net/W8bx9/

CSS

.circle {
    width: 60px;
    height: 60px;
    background-color: #110436;
    color: white;
    border-radius: 30px;
    float: left;
    margin: 10px;
    position: relative;
    top: -8px;
}
.circle_small {
    width: 60px;
    height: 60px;
    background-color: #e1dae8;
    color: white;
    border-radius: 30px;
    float: left;
    margin: 10px;
    position: relative;
    top: -8px;
}
.circle_small h3 {
    position: relative;
    color: white;
    border: none !important;
    text-align: center;
}
.circle h3 {
    position: relative;
    color: white;
    border: none !important;
    text-align: center;
}
#line {
    width: 420px;
    position: relative;
    left: -40px;
    top: -50px;
    border: 1px solid #e1dae8;
    height: 0px;
    color: #330066;
    border-style: dashed;
    z-index: -1;
}
#timeline {
    padding-top: 20px;
    margin-bottom: -10px;
}

HTML

<div id="timeline">
    <div id="r0" class="circle_small">
        <h3>P</h3>
    </div>
    <div id="r1" class="circle">
        <h3>1</h3>
    </div>
    <div id="r2" class="circle_small">
        <h3>2</h3>
    </div>
    <div id="r3" class="circle_small">
        <h3>3</h3>
    </div>
    <div id="r4" class="circle_small">
        <h3>4</h3>
    </div>
    <div id="r5" class="circle_small">
        <h3>A</h3>
    </div>
    <hr id="line">
</div>

methuselah90

Thanks for your response. I'm trying to find rows in which request.day_id and request_period_id do not equal 1 and do not exist. How can I go about doing this. Your SQL query looks like it is searching for rows where a match is found - I'm looking for rows where a match =1 isn't round.

methuselah90 Newbie Poster

Bear with me please because my SQL is not that good.

I want to write a query that takes into consideration information from 3 different tables.

Let me explain the situation: When a customer books a room, they have the preference of several rooms and the rooms can be booked on individual days (one unique booking has to be made per day) at different times.

I now want to write a query that will check if a room is available on a certain time of the day. These are the tables I have on my database:

room

This table stores information about each room

Fields:

> id (primary key)
> capacity    
> img 
> notes   
> building_id 
> roomstructure_id    
> lecturestyle_id

request

This table stores message about each request made

Fields

> id (primary key)
> day_id
> period_id
> preference_id (foreign key from preference.id)

preference

This table stores information about all the room preferences.

> id (PK)      
> request_id (foreign key from request.id)      
> room_id (foreign key from room.id)

I hope what I am trying to do has become apparent.

If for example I am checking whether room C233 is booked on Monday, 09:00 - I would need to look up the room information in the room table and then use the room_id in the preference table to look up the request_id.

Once I have the request_id which has been linked to a specific room (in the room preference table) I can see whether day_id=1 and period_id=1 in the ...

methuselah90 Newbie Poster

Is it possible to link jQuery menu to tabs?

For example if the user selects "By Filter" in the menu below I want it to open up the Search By Filters tab. How can I achieve this?

JS

$("#menu").menu();
$("#search").tabs();

HTML

<ul id="menu" style="border: 0px; background:none">
<li><a id="2" style="cursor: pointer">Search</a>
<ul style="z-index: 2">
<li><a id="2a" style="cursor: pointer">By Filter</a></li>
<li><a id="2b" style="cursor: pointer">By Room</a>    
</li>
</ul>
</li>
</ul>

<div id="search" style="z-index: 1;">
  <ul>
    <li><a href="#search-1">Search By Filters</a></li>
    <li><a href="#search-2">Search By Room</a></li>
  </ul>
  <div id="search-1">
  </div>
  <div id="search-2">
  </div>
</div>

methuselah90 Newbie Poster

I am trying to display results from the process page on the host page. At the moment I keep getting the Uncaught ReferenceError: data is not defined error message. How do I go about fixing this?

form.php

$(document).ready(function () {
    // variable to hold request

    var request;
    // bind to the submit event of our form

    $("#commentForm").submit(function (event) {

        // abort any pending request
        if (request) {
            request.abort();
        }

        // setup some local variables
        var $form = $(this);

        // lets select and cache all the fields
        var $inputs = $form.find("input, select, button, textarea");

        // serialize the data in the form
        var serializedData = $form.serialize();

        // lets disable the inputs for the duration of the ajax request
        $inputs.prop("disabled", true);

        // fire off the requestp
        var request = $.ajax({
            url: "process_msg.php",
            type: "post",
            data: serializedData
        });

        // callback handler that will be called on success
        request.done(function (response, textStatus, jqXHR) {

            // log a message to the console
            console.log("Hooray, it worked!");

            // flash update text
            $("#flashmessage").html(data)
        });

        // callback handler that will be called on failure
        request.fail(function (jqXHR, textStatus, errorThrown) {

            // log the error to the console
            console.error(

                "The following error occured: " + textStatus, errorThrown);
        });

        // callback handler that will be called regardless
        // if the request failed or succeeded
        request.always(function () {

            // reenable the inputs
            $inputs.prop("disabled", false);
        });

        // prevent default posting of form
        event.preventDefault();
    });
});

<form id="commentForm">
    <textarea maxlength="255" placeholder="What's on your mind?" id="post_box"
    style="font-family: Verdana; border-color: #dedede" name="msg"></textarea>
    <br />
    <input type="hidden" name="user_id" value="<? echo ...

methuselah90 Newbie Poster

[CODE]function doit(m){
return(m+2);
}
function ask(n){
return(n+doit(n+1)+n);
}
alert(ask(2));[/CODE]

How do you read this code? It returns 9 but I would like to how it does as part of my JavaScript course.

methuselah90 Newbie Poster

I'm writing a piece of JS code that returns a result of true if the pattern appears in string as a substring (case sensitive) but would like to extend its functionality to returns true if all the individual characters of pattern appear in string (regardless of order).

For example:

This is what the program currently does:

[CODE]match1("adipisci","pis") returns true
[/CODE]

Whereas I would now like it to do this:

[CODE]match1("adipisci","sciip") returns true
2
match2("adipisci","sciipx") returns false because x does not exist in variable
3
match3["adipisci","adipisci"] returns true in array element 1 and 2 if "sciip" is searched
4
match4["adipisci","adipiscix"] returns false in array element 1 and true in array element 2 if "sciipx" is searched[/CODE]

I am having difficulty implementing this into my code... this is what I've done so far:

[CODE]var pages=[
"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"Nulla imperdiet laoreet neque.",
"Praesent at gravida nisl. Quisque tincidunt, est ac porta malesuada, augue lorem posuere lacus, vitae commodo purus nunc et lacus."
];
var search_term = prompt('Type in search term: ','Search word');
// ask which search term the user wants to search for with default being 'Search Term'
function find_s(w) {
var indexes = [0,0,0] // create an array to hold pages where search term found
var iii = 0 // create variable to increment the number of finds in each page
for (var ii=0;ii<pages.length;ii++) {
// for each page in the array
for (var i=0;i<pages[ii].length;i++) {
// for each character in the chosen page
if (pages[ii].substr(i,w.length).toLowerCase()==w.substr(0,w.length).toLowerCase()) ...

methuselah90 Newbie Poster

good morning all!

i'm struggling at the present time to style a drop down select menu that will fit into my current design for mobile devices (i.e. especially the iPhone right now)

[URL="http://i.stack.imgur.com/Gn7se.png"]http://i.stack.imgur.com/Gn7se.png[/URL]

^^^ this is how it looks like at present time on my iPod

[URL="http://i.stack.imgur.com/wsEtQ.png"]http://i.stack.imgur.com/wsEtQ.png[/URL]

^^^ this is how it looks at present on Google Chrome

i would really like for the iPod select drop down to mirror the desktop drop down if possible as demonstrated with the textfields but i seem to be stuck at a hard point.

please find the current css code i am using below:

[CODE]/****
FORM STYLING
*****/
button.button{
font-size: 14px;
font-weight: bold;
background-color: #333;
width: 95%;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
padding: 10px;
text-align: center;
color: #CCC;
border: none;
}
input, textarea{
font-family:Helvetica,Arial,sans-serif;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
color:#555555;
background:#FBFBFB none repeat scroll 0 0;
border:1px solid #E5E5E5;
font-size:12px;
line-height: 16px;
margin-bottom:16px;
margin-right:6px;
margin-top:2px;
padding:10px;
display: block;
width: 92%;
}
select {
font-family:Helvetica,Arial,sans-serif;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
color:#555555;
background:#FBFBFB none repeat scroll 0 0;
border:1px solid #E5E5E5;
font-size:12px;
line-height: 16px;
margin-bottom:16px;
margin-right:6px;
margin-top:2px;
padding:10px;
display: inline-block;
width: 30%;
}
label{
font-size: 12px;
font-weight: bold;
color:#5B5A5A;
display: block;
}
label span, .required {
color: #C00;
}[/CODE]

i would appreciate any help in resolving this css conundrum!

many thanks in advance

methuselah90 Newbie Poster

hi everyone i am trying to get validate captcha on my form but i would like validation to take place on the form without a change of state.

currently the page refreshes to display the error message and the page loses all form values and i can understand that this can be frustrating to users who have to retype the information.

how can i get the error message to display right below the captcha image area? this way the user can make the necessary corrections to their mistake without re-entering everything.

[CODE]<?php session_start();
include_once ("resources/Connections/kite.php");
include_once $_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';
$securimage = new Securimage();
?>

New Account

methuselah90 Newbie Poster

[QUOTE]Warning: fopen() expects parameter 1 to be string, array given in /home/speedycm/public_html/speedyautos/carphoto.php on line 42

Warning: filesize() [function.filesize]: stat failed for Array in /home/speedycm/public_html/speedyautos/carphoto.php on line 43

Warning: fread(): supplied argument is not a valid stream resource in /home/speedycm/public_html/speedyautos/carphoto.php on line 43

Warning: fclose(): supplied argument is not a valid stream resource in /home/speedycm/public_html/speedyautos/carphoto.php on line 44[/QUOTE]

i keep getting these error messages whenever trying to upload a picture on my website and i'm not sure how to sort them out. can anyone please help? lines 36-59 read:

[CODE]$CarInfo->Load();
if ($hidaction == "addphoto")
{
$ctrP = 0;
foreach ($_FILES['pics'] as $pics)
{
if ($_FILES['pics']['name'][$ctrP] <> "")
{
if (is_uploaded_file($_FILES['pics']['tmp_name'][$ctrP]) or die("No Image: " . $_FILES['pics']['name'][$ctrP]))
{
$ext = substr(strrchr($_FILES['pics']['name'][$ctrP], "."), 1);
$fp = fopen($_FILES["pics"]["tmp_name"], 'rb');
$contents = fread($fp, filesize($_FILES["pics"]["tmp_name"]));
fclose($fp);
if (preg_match("/system/", $contents) OR preg_match("/<\?/", $contents))
{
$error .= "Invalid image: {$_FILES['pics']['name'][$ctrP]}
";
//$pieces = explode(".", $_FILES['pics']['name'][$ctrP]);
//$ext = $pieces[count($pieces) - 1];
} elseif ((in_array($ext, $types_array)) AND ($_FILES['pics']["size"][$ctrP] < (MAXFILE_SIZE * 1000000)))
{
$orgImageName = "cid" . $propertyid . "" . strreplace(" ", "", $_FILES['pics']['name'][$ctrP]);
$thmImageName = "thumb_cid" . $propertyid . "" . strreplace(" ", "", $_FILES['pics']['name'][$ctrP]);
$dtlImageName = "dtl_cid" . $propertyid . "" . strreplace(" ", "", $_FILES['pics']['name'][$ctrP]);[/CODE]

many thanks in advance!

methuselah90 Newbie Poster

[IMG]http://i.imgur.com/hSalo.png[/IMG]

hi everyone! i'm trying to create an dynamic jquery tabbed interface and need some help. so far i've managed to draft a rough idea of how i wish the interface to look like and would currently appreciate suggestions on how to get production under way.

1) this is default tab that is opened once the page loads
2) there is an open control right besides the default tab
3) once the open control is selected a drop down appears querying my database of all the categories selected, once a category has been selected then the new tab loads up with the required content
4) left and right scroll controls have been implemented to allow for overflow within the confined space. they act as a scroll of some sort, once there are more than enough tabs within the 'viewable area' the user can use the controls to move to the next set of tabs

i would appreciate any assistance on this small project. many thanks!

methuselah90 Newbie Poster

i've noticed that on ie whenever i hover the mouse pointer click a selected tab and then move onto the second, both tabs are 'active' rather than the one tab i have shifted focus away from resetting to default. this leads to all my tabs lighting up as active which is rather confusing. funnily enough i don't have this problem on chrome. any workarounds? thanking you in advance!

[CODE]
$(document).ready(function(){
$('#tabs div').hide();
$('#tabs div:first').show();
$('#tabs ul li:first').addClass('active');
$('#tabs ul li a').click(function(){
$('#tabs ul li').removeClass('active');
$(this).parent().addClass('active');
var currentTab = $(this).attr('href');
$('#tabs div').hide();
$(currentTab).show();
return false;
});
});

* { padding: 0; margin: 0; } html, body { height: 100%; width: 100%; background-image:url(main_bg.png); } body { font-family: "lucida sans", verdana, arial, helvetica, sans-serif; font-size: 75%; } h1 { font-size: 1.4em; padding: 10px 10px 0; } p { padding: 0 10px 1em; } #container { min-height: 100%; border-left: 0px solid #666; border-right: 0px solid #666; padding: 0px 40px 0px 40px; margin: 0 auto; } * html #container { height: 100%; } #header { height: 40px; width: 100%; padding-top: 10px; } .header_column { position: absolute; padding-top: 0px; } #header_second { margin-left: 50%; color:#FFF; } #header_third { margin-left: 80%; color:#FFF; } #body { height: 100%; width: 100%; } .body_column { position: absolute; background-color:#FFF; height: 100%; overflow: auto; } #body_first { width: 22%; background-color: transparent; height: 640px; margin-top: 10px; } #body_second { margin-left: 170px; width: 36%; background-color:#FFF; height: 640px; } #body_third { margin-left: 58%; width: 36%; border: 1px; background-color: #919191; height: 640px; ...

methuselah90 Newbie Poster

i'm having difficulty achieving this. any help would be appreciated. i would like the div content1 and content2 to fill up the remaining space vertically in a window with a set minimum height. it needs to adjust automatically with window resize. many thanks!

[CODE]
html, body {
height: 100%;
background-color: #E1E1E1;
}
body, td, th {
font-family: Arial, Helvetica, sans-serif;
height: 100%;
}

methuselah90 Newbie Poster

good afternoon all,

i am currently writing a system in PHP that requires interface with a USB thermal receipt printer for a friend upon form submission. currently i have read about interfacing with devices containing a parallel port but there has not been much detail on how i can use PHP to interface with a USB thermal receipt printer. hence any advice on the topic would be appreciated.

so far i have designed the receipt consisting of data that has been posted from the form. the next step would be to reproduce it on the thermal printer.

thank you for your time and interest.

God bless

methuselah90 Newbie Poster

after finding out that i couldn't use form submit (which refreshes the page) alongside bockui i have decided to move onto ajax. i am not too good at ajax but i get the gist of it. but now block ui does not wish to work at all. here is the javascript i am using:

[CODE]
$(document).ready(function() {

//if submit button is clicked
$('#submit').click(function () {        

    //Get the data from all the fields
    var status = $('input[name=status]');
    var pRent = $('input[name=pRent]');
    var rentPaid = $('input[name=rentPaid]');
    var pDate = $('input[name=pDate]');

    //Simple validation to make sure user entered something
    //If error found, add hightlight class to the text field
    if (status.val()=='') {
        status.addClass('hightlight');
        return false;
    } else status.removeClass('hightlight');

    if (pRent.val()=='') {
        pRent.addClass('hightlight');
        return false;
    } else pRent.removeClass('hightlight');

    if (rentPaid.val()=='') {
        rentPaid.addClass('hightlight');
        return false;
    } else rentPaid.removeClass('hightlight');

            if (pDate.val()=='') {
        pDate.addClass('hightlight');
        return false;
    } else pDate.removeClass('hightlight');

    //organize the data properly
    var data = 'status=' + status.val() + '&pRent=' + pRent.val() + '&rentPaid='
    + rentPaid.val() + '&pDate=' + pDate.val();

    //disabled all the text fields
    $('.text').attr('disabled','true');

    //show the loading sign
    $('.loading').show();

    //start the ajax
    $.ajax({
        //this is the php file that processes the data and send mail
        url: "resources/process.php",   

        //GET method is used
        type: "GET",

        //pass the data         
        data: data,     

        //Do not cache the page
        cache: false,

        //success
        success: function (html) {              
            //if process.php returned 1/true (send mail success)
            if (html==1) {                  

                //blockui

        $.blockUI({ message: $('#question'), css: { width: '1024px' } });  
    $('#yes').click(function() { 
        // update the block message 
        $.blockUI({ message: "<h1>Remote call in progress...</h1>" ...

methuselah90

thank you my good sir! these are the changes i've made. but now the page refreshes to submit the data before blockui ([url]http://jquery.malsup.com/block/#page[/url]) is dislayed. i feel this is a part of the submit procedure. so now the values submit but blockui will not show.

[CODE]<?php require_once('Connections/rent.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$colname_driver = "-1";
if (isset($_GET['id'])) {
$colname_driver = $_GET['id'];
}
mysql_select_db($database_rent, $rent);
$query_driver = sprintf("SELECT * FROM rent WHERE id = %s", GetSQLValueString($colname_driver, "int"));
$driver = mysql_query($query_driver, $rent) or die(mysql_error());
$row_driver = mysql_fetch_assoc($driver);
$totalRows_driver = mysql_num_rows($driver);

$user = $_GET['user'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

@import "resources/jquery.keypad.css"; $(document).ready(function() { $("#pay").click(function() { $.blockUI({ message: $('#question'), css: { width: '1024px' } }); }); ...

methuselah90

i really appreciate your help on this brother. i have read through everything and understood your example well and applied it to my page. it still does not work. here is the complete code below with the necessary changes:

[CODE]<?php require_once('Connections/rent.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$colname_driver = "-1";
if (isset($_GET['id'])) {
$colname_driver = $_GET['id'];
}
mysql_select_db($database_rent, $rent);
$query_driver = sprintf("SELECT * FROM rent WHERE id = %s", GetSQLValueString($colname_driver, "int"));
$driver = mysql_query($query_driver, $rent) or die(mysql_error());
$row_driver = mysql_fetch_assoc($driver);
$totalRows_driver = mysql_num_rows($driver);

$user = $_GET['user'];
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

@import "resources/jquery.keypad.css"; $(document).ready(function() { $("#pay").click(function() { $.blockUI({ message: $('#question'), css: { width: '1024px' } }); }); $('#yes').click(function() { // update the block ...

methuselah90

it works great but the values now do not appear in the div window. am i doing something wrong?

methuselah90 Newbie Poster

good day everyone,

i just wanted to ask for some help in using block ui for forms.

i have a form with 3 values.

once the form is submitted then block ui will appear with all the information from the form "echoed" within the div.

but the problem is each time i use a submit button, blockui doesn't work and immediately shuts when the form is submitted.

here is a sample of the code i am working with (sorry if it quite long):

block ui javascript

[CODE]
$(document).ready(function() {

    $("#pay").click(function() { 
        $.blockUI({ message: $('#question'), css: { width: '1024px' } }); 
    }); 

    $('#yes').click(function() { 
        // update the block message 
        $.blockUI({ message: "<h1>Remote call in progress...</h1>" }); 

        $.ajax({ 
            url: 'wait.php', 
            cache: false, 
            complete: function() { 
                // unblock when remote call returns 
                $.unblockUI(); 
            } 
        }); 
    }); 

    $('#no').click(function() { 
        $.unblockUI(); 
        return false; 
    }); 

}); 

[/CODE]

block ui

[CODE]
Would you save all changes and print the receipt?

DRIVER RECEIPT

DATE PAID       TOTAL RENT £ RENT PAID £ ...

methuselah90 Newbie Poster

good day guys,

i have loaded jquery keypad ([url]http://keith-wood.name/keypad.html[/url]) in a block ui modal window ([url]http://jquery.malsup.com/block/[/url]) but sadly it refuses to render in the modal window. has anyone encountered this problem yet? i have tested the jquery pad outside of the block ui modal and it works perfectly fine but when it is inside the block ui modal clicking on it does not open anything up at all. here is my code:

loading jquery, keypad css and blockui

[CODE]
@import "resources/jquery.keypad.css";

        <script src="resources/jquery.js"></script>     
        <script src="resources/blockui.js"></script> 
        <script src="resources/jquery.keypad.js"></script>       
<script type="text/javascript"> 
$(function () {
    $('#defaultKeypad').keypad();
});
</script>[/CODE]

creating unique instances of block ui

[CODE]<?php for ($i = 1; $i <= 300; $i++) {
echo "

$(document).ready(function() { $('#t".$i."').click(function() { $.blockUI({ message: $('#q".$i."'), css: { width: '1600px' } }); }); $('#yes".$i."').click(function() { // update the block message $.blockUI({ message: '
Remote call in progress...
' }); $.ajax({ url: 'wait.php', cache: false, complete: function() { // unblock when remote call returns $.unblockUI(); } }); }); $('#no".$i."').click(function() { $.unblockUI(); return false; }); }); "; } ?> [/CODE] creating unique instances of div modal windows, i have included jquery keypad here [CODE]

methuselah90 Newbie Poster

hi guys

really i don't know what im doing wrong... i am trying to process multiple radios with mysql. the first step has involved me echoing the results on the process page. each time i select any radio option it simply displays the first row result. this is that i see after trying to submit the form:

[QUOTE]Notifications

Thank you. The notifications have been updated successfully.

statusid: 14 notc2: 1

Return[/QUOTE]

this is the code for the form:

[CODE]

Notifications

<?php include("progress_insertcomment.php"); ?>

<?php

// Make a MySQL Connection
mysql_select_db("speedycm_data") or die(mysql_error());

$query_comment = "select * from tbl_alert order by id desc limit 1";
$comment = mysql_query($query_comment, $speedycms) or die(mysql_error());
$row_comment = mysql_fetch_assoc($comment);
$totalRows_comment = mysql_num_rows($comment);

?>

Add

           <!--- notification history --->

           <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

           <table border="0" cellspacing="2" cellpadding="2">
              <?php

if ( $row_comment == 0 ) {

    echo "<span style='font-size: 11px;'>No current alerts.</span>";

} else {

// Get all the data from the "example" table
$result = mysql_query("SELECT * FROM tbl_alert ORDER BY id DESC")
or die(mysql_error());

while($rows=mysql_fetch_array($result)){ ?>