AleMonteiro 238 Can I pick my title?

I would suggest to you to change the href with JavaScrit, but it'll work too doing in the back-end.

AleMonteiro 238 Can I pick my title?

I really didn't understand what you're trying to do.

It's a html editor or tag highlight or something like it?

AleMonteiro 238 Can I pick my title?

Try chaning command.BeginExecuteNonQuery() to command.ExecuteNonQuery()

AleMonteiro 238 Can I pick my title?

OMG, it's really really messed up.

I think you'll need to go in steps, fixing a thing each time.

The first thing that I noted is a HTML markup error, there's a </div> that has no begining tag, after the <div id="headerWrapper"> closing tag.

AleMonteiro 238 Can I pick my title?

It's seems alright to me. Tested in IE, Opera and Firefox. Also, all links have the same styles applied.

AleMonteiro 238 Can I pick my title?

So, if you have the var setted to true, you can ignore the window.click. And after ignoring the window.click, set the var to false, so that in the next click you can close it.

Doesn't that work? Any doubts in this implementation?

AleMonteiro 238 Can I pick my title?

You can make a simple test to verify what occurs.

Declare a var buttonClicked = false. Inside the $(button).click() set it as true, then inside the $(window).click() alert the var to see it's state.

If the button is 'clicked' before, you can use this var to ignore the event at the first window.click().

AleMonteiro 238 Can I pick my title?

By different fancy box you mean different styles?

AleMonteiro 238 Can I pick my title?

You're welcome.

Good luck

AleMonteiro 238 Can I pick my title?

Those are the steps that you need to take care of:

Add a listener to the change event of the select.
Once changed, send the selected value to a php page (either using form submit or AJAX)
The PHP page will read the value and query the database.
If using AJAX: The PHP page will return the options. The JS handler to the AJAX will insert the options in the select
If using form submit: The PHP page will response the whole page again. This way you have to check if there's a selected value or not in the session to either show both selects or only the first.

I may be forgotting something, but that's the basic.

Obs.: I had to remove the enumeration and format because the post validation have some kind of bug.

AleMonteiro 238 Can I pick my title?

If I understood what you are trying to do, you'll have to do the following:

  1. Uplod the selected file to the server (using <input type="file" />).
  2. Read the file on the server and show in the text area.
  3. User edit the file and click save
  4. Send the edited text to the server
  5. The server will then either save the file to the disk and return the download link(like /editedtext.txt) OR it'll make a response to already download the text(using response headers like content-description and file-name, but I don't know exactly).

You could do only with the ActiveX that you have, but It'll only work on IE or browsers that thave ActiveX plugins, like Firefox.

AleMonteiro 238 Can I pick my title?

Are you using AJAX or posting forms?

AleMonteiro 238 Can I pick my title?

You are stuck in the iframe connection or in showing the location on the image? Or both?

To link the actions between IFrames, you could use the parent as the main comunication center, this way, one frame will call a function on the parent that will call a function on the other frame.
I.E.:

// Frame Right
function onStoreClick(store) {
    parent.onStoreClick(store);
}

// Parent
function onStoreClick(store) {
    var frame = document.getElementById('frameLeft');
    var frameDocument = frame.contentDocument || frame.contentWindow.document; // Cross broswer compatibility
    frameDocument.onStoreClick(store);  
}

// Left Frame
function onStoreClick(store) {
    // Do something to show the store name
}

And to show the tooltip you could either slice the image in various pieces, as suggested by DarkMonarch, or you could keep the one image and store the position for each tooltip.
I.E:

var tooltips = {
    'Store1' : {
        name: 'Shoes Store',
        posX: 5,
        posY: 15
    },
    'Store2' : {
        name: 'Banana Store',
        posX: 150,
        posY: 25
    }
};

function showTolltiper(storeId) {
    var store = tooltips[storeId];
    if ( typeof store === 'undefined' ) {
        alert('StoreId not found');
        return;
    }

    // show tooltip
}
AleMonteiro 238 Can I pick my title?

In this case you would have to loop throw the DataSource itens and test one by one, using simple complare(==), IndexOf(to match the begining) or regular expression(to do more sofisticated matches).

Another way is to query the database for matches using the equals or like operators.

AleMonteiro 238 Can I pick my title?

You are missing the closing > for the option, ater the last " for the value.

<option value="<?php echo $row['whatever']; ?>"> <?php echo $row['whatever2'];?></option>

AleMonteiro 238 Can I pick my title?

You could try this also:

$('.right-slide').hover(
    function () {
        $(this).children('.info-bubble').show('slide', {direction: 'left'}, 100);
    }, 
    function () {
        $(this).children('.info-bubble').hide('slide', {direction: 'left'}, 100);
    }
);
$('.left-slide').hover(
    function () {
        $(this).children('.info-bubble').show('slide', {direction: 'right'}, 100);
    }, 
    function () {
        $(this).children('.info-bubble').hide('slide', {direction: 'right'}, 100);
    }
);
AleMonteiro 238 Can I pick my title?

But did you test without to see if that is the problem?

AleMonteiro 238 Can I pick my title?

Post your html structure for the menu.

You can try one thing, instead of using slide to hide/show try using hide/show without effects.
I suggest you try it, because the problem may be in the effects.

AleMonteiro 238 Can I pick my title?

max = end * last

AleMonteiro 238 Can I pick my title?

You're welcome, just mark as solved please.

AleMonteiro 238 Can I pick my title?

You must use the cancel option: http://api.jqueryui.com/draggable/#option-cancel

<div class="draggable">
    <span class="text">SomeText</span>
</div>

$(".draggable").draggable({
    cancel: '.text'
});
AleMonteiro 238 Can I pick my title?

How about

// @val current cell value
// @max last cell value
function getValueCss(val, max) {

    var d = Math.floor( max / 3 );

    if ( val < d ) {
        return 'low';
    }
    else if ( val < (d*2) ) {
        return 'middle';
    }
    else {
        return 'high';
    }
}
AleMonteiro 238 Can I pick my title?

If the function getValueCss always returns 'high', then all cells will be green. In that function you need to code the algorithm that will decide the color.

AleMonteiro 238 Can I pick my title?

Try something like this:

for (var i = start; i <= end; i++) {
                    MultTbl += '<tr>';
                    MultTbl += '<th>' + i + '</th>';
                    for (var j = 0; j < last; j++) {
                        var val = (i * (start + j));
                        MultTbl += '<td class="' + getValueCss(val) + '">' + val + '</td>';
                    }
                    MultTbl += '</tr>';

                }

// Recieves a value and return the css class name
function getValueCss(val) {
    // do something and return some css
    return 'some css name'
}
AleMonteiro 238 Can I pick my title?

What's your code to create the table cells?

In that code you should add the css class to the cells.

AleMonteiro 238 Can I pick my title?

I think the best solution is to add an css class to images without border.:

img.no-border { border: none; }

Then, add the class 'no-border' to the images that you want.

AleMonteiro 238 Can I pick my title?

Did you import System.Data.SqlTypes ?

AleMonteiro 238 Can I pick my title?

retVal.Value returns 0 or 1 to bit columns, so converting to bool works. However, retVal.SqlValue returns an SqlBoolean object, that can't be converted to a bool, but the SqlBoolean object has an Value property that is a bool.

So, both should work:

CBoll(retval.Value)
'And
CType(retval.SqlValue, 'SqlBoolean').Value

I don't know if the syntax are ok cause I don't code much in VB. But you'll get the idea.

AleMonteiro 238 Can I pick my title?

Did you check if the DataTable has the data?

I think you have to create to datatables, on for each dropdown.

new SqlDataAdapter("SELECT ProgrammeCode FROM Programme")
new SqlDataAdapter("SELECT StaffID FROM Staff")

And I would invert the order of the IF's, if (ddlProgramme.Items.Count <= 0 && ddlStaff.Items.Count <= 0) should be first. It makes more sense. Note that I changed the operator to &&.
And also you should use else if.

AleMonteiro 238 Can I pick my title?

Your code doesn't make any sense. When the user click any part of the #menu (incluing itens and sub menu) it will open the submenu, and when the user hover the mouse (hover is an alias for mouse over and mouse out events) it will close.

I think that what you want is to open the submenu if the user clicks only the <li> or even only the <li> super hero. Is that right?

If so, try this:

<ul id="menu">
  <li>Change text</li>
  <li>
        <label>Super Hero</label>
        <ul id="submenu">
          <li>Color Theme</li>
        </ul>
    </li>
</ul>

I'm using <label> to hold the link because I only want to close the submenu if the user clicks the label, and not the submenu also.

$("#menu > li:has(ul) > label").click(function(){ // Add click handler to the #menu li's label that have an ul brother
        $(this).next("ul").slideToggle("slow"); // First click opens, second closes
    });

It will open the submenu only if Super Hero is clicked, and once it's clicked again it'll close.

AleMonteiro 238 Can I pick my title?

Assuming that row is actually an TR object, try this:

$.ajax({
    type: "POST",
    url: "delete_order.php",
    data: "id="+id,
    success: function(){
        row.fadeOut(1000, function(){ 
            row.remove();
        });
    }
});

And please, ident your code before posting. It helps us to help you.

AleMonteiro 238 Can I pick my title?

Hello.

$($(this)).text() works but it's redundant. $(this) work as well and it's better for performance and code understanding.

About the white space, you can use the trim function: var text = $.trim($(this).text());
It will remove any extra white spaces.

And I'd also change <button>day</button> to <button id="btnDay" type="button">day</button>. And add the click handler as $("#btnDay").click(function{...});

Using type="button" will prevent any forms to be submited by mistake. By default, a button is of type submit, and this means that if the button is inside a form, it'll submit the form when clicked.

Using the ID btnDay will only add the click handler to btnDay button. Using the tag button will add the handler to all buttons of the page.

AleMonteiro 238 Can I pick my title?

Always use different aliases, ie: SELECT p.ID as personID, c.ID as CompanyID...
row["personID"] and row["companyID"]

AleMonteiro 238 Can I pick my title?

I just checked your link and it seems to be working ok.

Do you have any problems with it?

AleMonteiro 238 Can I pick my title?

I didn't understand much of what you want... but to get the count it would be:

DECLARE @rowsCount int

SELECT
    @rowsCount = count(*)
FROM 
    [dbHIS].[dbo].[PATIENT_INFORMATION]
WHERE
    (FIRSTNAME LIKE @FIRSTNAME OR @FIRSTNAME IS NULL)
    OR (LASTNAME LIKE @LASTNAME OR @LASTNAME IS NULL)
    OR (MIDDLENAME LIKE @MIDDLENAME OR @MIDDLENAME IS NULL) 
AleMonteiro 238 Can I pick my title?

What value are you trying to decrement? Because as I far I undertand, you're not increment anything on your code, you are inserting a new record. Am I wrong?

AleMonteiro 238 Can I pick my title?

Even when you use aliases on your query, you don't use it to get the value from the reader.

while (dtrStudent.Read())
            {
                lblStudentID.Text = dtrStudent["LearnerID"].ToString();
                lblStudentName.Text = dtrStudent["Name"].ToString();
                lblEmail.Text = dtrStudent["Email"].ToString();
            }

The above should work fine.

AleMonteiro 238 Can I pick my title?

Thanks, I'll study this guy and try to implement it.

AleMonteiro 238 Can I pick my title?

Let see if I can explain...

The form onSubmit expects True or False. True means that the form is to be submited, False means to cancel the submit.

onSubmit=validateForm(); return false; Is saying to the browser that when the onSubmit is called, it'll execute validateForm() and, despise the result, it will always return false.

onSubmit= return validateForm(); Is saying to the browser to execute the validateForm and return it's result.

I think it's more clear if you think all in JS:

// onsubmit=validateForm(); return false;
form.onsubmit = function() {
    validateForm();
    return false;
};

//onsubmit=return validateForm();
form.onsubmit = function() {
    return validateForm();  
};
adam.adamski.96155 commented: Thanks for the explanation :) +4
AleMonteiro 238 Can I pick my title?

Hi, try jQuery scrollTo plugin. I used a couple of times and it works very nice.

http://flesler.blogspot.com.br/2007/10/jqueryscrollto.html

AleMonteiro 238 Can I pick my title?

It's impossible my friend. As JormeM said, the content is already on the browser. Most browsers has features that show all the images that were downloaded, and to copy the text the user simple need to view the page source and he can copy all he want.

Implementing "security" of data with JavaScript will only prevent newbies from getting the data, because you can cancel the right button of the mouse and even ctrl+c.

But if anyone really wants to copy your data, they will.

AleMonteiro 238 Can I pick my title?

Another way of doing this stuff, the way I do, is using a button without subtmit (type=button), then add a click handler the button that will perform the validation (onclick=validateForm()). If the form is valid, then you submit it (form.submit()).

AleMonteiro 238 Can I pick my title?

I think the correct use would be: onsubmit="return validateForm(this);"

AleMonteiro 238 Can I pick my title?

Oh right, now I get it.

So, I did a couple of tests using simple text files and none worked. I try letting the broswer do the job, tried with the code posted and also with a lib called JSXCompressor.

So I'm thinking that the problem may be in the gzip file. I'm currently ziping with GZip for windows.

Maybe I should implement something in the server side to zip the files instead of using a third part software.

Any thoughts on good compression algorithms?

AleMonteiro 238 Can I pick my title?

You're welcome.

Just mark the thred as solved, and my answer as helpful if you can.

Seeya.

AleMonteiro 238 Can I pick my title?

Is not too much pretty, but it works:

<!doctype html>

<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>jQuery UI Sortable - Connect lists</title>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
    <script src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css" />
    <style>
    #sortable1, #sortable2 { list-style-type: none; margin: 0; padding: 0 0 2.5em; float: left; margin-right: 10px; }
    #sortable1 li, #sortable2 li { margin: 0 5px 5px 5px; padding: 5px; font-size: 1.2em; width: 120px; }
    </style>
    <script>
    $(function() {

        $( "#sortable1, #sortable2" ).sortable({
            connectWith: ".connectedSortable",
            receive: function(evt, ui) { 
                if ( ui.item.parent().hasClass("acceptOnlyOne") ) { // if drop target only accept one item
                    if ( ui.item.parent().children().length > 1 ) { // check if it has more than one item
                        alert("You can drop only one item in here!"); // alert something
                        $("#sortable1").append( ui.item.detach() ); // detach the dropped item from the dropped target and append it to the previous container
                    }
                }
            }
        }).disableSelection();
    });
    </script>
</head>
<body>

<ul id="sortable1" class="connectedSortable">
    <li class="ui-state-default">Item 1</li>
    <li class="ui-state-default">Item 2</li>
    <li class="ui-state-default">Item 3</li>
    <li class="ui-state-default">Item 4</li>
    <li class="ui-state-default">Item 5</li>
</ul>

<ul id="sortable2" class="connectedSortable acceptOnlyOne" style="min-height: 30px; min-width: 100px; border: 1px solid black;">
</ul>


</body>
</html>
AleMonteiro 238 Can I pick my title?

Yes, it's used a lot.

But I don't really like it. I prefer to use popup dialogs in the same window, with divs

AleMonteiro 238 Can I pick my title?

Can't you have another page to be loaded in the new window? Why do you have to write it in JS?

Even if need to pass any data you can do it later. If both pages are in the same domain you can interact with each other with JS.

AleMonteiro 238 Can I pick my title?

Line 35 seems to be wrong: tmp+='<\/script>

AleMonteiro 238 Can I pick my title?

The best way to find out what you need to change is to use a HTML element inspector. I suggest FireBug for Firefox or developer's tools for IE (I prefer Firebug). I think Chrome and Safari must have something similiar too.

In example, using FireBug:
1. Open the page
2. Open Firebug ( F12 )
3. Click in the 'Inspect Element' tool (Second button from the left)
4. Click the element you want to inspect
5. Read the styles that are applied to the element

This way you can see what css classes are being applied to the element. You can even change the properties at run time and see the results.