AleMonteiro 238 Can I pick my title?

Oh Ok. So if a PM can be sent just to one user, there only two options of deleting the message: either the user who sent deleted it or the user who receieve deleted it, or both. So you could just add two columns on the PM Table: ToVisible, FromVisible.

It's simpler, isn't it?

AleMonteiro 238 Can I pick my title?

If I understood you structure, if a user send the same PM to multiple users, this PM will be inserted multiple times into the PM table. Is that correctly? I assumed this because of the ToId field.

If I supposed correctly, then you don't need the second table. Because when a user deletes the recieved PM you'll only update or delete it's own record and not from every user that recieved that PM.

That said...

Another way of doing this, that I prefer, is to avoid duplicating the PM's. So you'd have an PM table only with FromID and the PM settings, and another table PM_Receivers (in example) that would relate the PM with the receivings users.
This way the body of the PM (that can be large sometimes) will be stored only once, and you have flexibility to handle users options to delete, hide, restore and etc the receiveds PM's.

This way a trigger woudn't be helpfull, because the PM table would not have the ToID to be inserted on the other table, you'd have to do it with PHP.

Hope it helps.

AleMonteiro 238 Can I pick my title?

None of the styles are being applyed? If so it may be a wrong reference to the css style sheet.

To verify this type of problem you can use this steps in any browser debugger(FireBug or Developers Tools in example):
1. Check if the CSS file was downloaded (in the Network tab)
2. Check if the CSS file was loaded correctly (in the styles tab)
3. Check if the element has the css class applied to them (in the HTML tab use the tool Insepect Element and click at it)

If the css style is at the same file that the JS and HTML, then open the console and check if there's any erros thrown.

Hope it helps.

AleMonteiro 238 Can I pick my title?

What do you mean by "they do not appear in the context that I gave them"? I didn't understand your problem.

AleMonteiro 238 Can I pick my title?

Try putting those two lines at the begining of the page and see if throws any other errors:

error_reporting(E_ALL);
ini_set('display_errors', 1);

You could also try using function_exists to check if the function is defined.

AleMonteiro 238 Can I pick my title?

There are some steps that you can do to verify where the problem lies:

  1. Debug the JavaScript code with your browser to see if $("form#myForm").serialize() is returning what is expected.
  2. Use your browser network watcher to ensure that the data is being sent
  3. Debug your PHP code to ensure that the data is recieved

If the data is recieved in your PHP code then is just a matter of validating the data and inserting into the DB.

Good luck.

AleMonteiro 238 Can I pick my title?

Try debugging and watching each variable to see it's state

AleMonteiro 238 Can I pick my title?

It's seems that all important code is inside functions that you didn't post, like have_posts(), the_post() and post_class()

By the code posted I think you can do the filter altering only the have_posts() function but we need to see the code so we can help.

AleMonteiro 238 Can I pick my title?

I don't have much experience with VB, but I would try something like this:

Dts.Variables("User::ReNameFile").Value = Dts.Variables("User::fileName").Value.ToString() + DatePart(DateInterval.Month, Now).ToString() + DatePart(DateInterval.Year, Now).ToString() + ".csv"
AleMonteiro 238 Can I pick my title?

If your question is resolved, please set the post as Solved and also mark the answers that was helpfull to you.

AleMonteiro 238 Can I pick my title?

No, there is not a problem. There is only methods to do it. You can make a insert from a select, like I posted.

AleMonteiro 238 Can I pick my title?
AleMonteiro 238 Can I pick my title?

I'd do it like this:

"insert into hostel_info(hostelName,rooms,capacity) select HostleName, '" + hmr.RoomNO + "','" + hmr.CapacityID + "'  from tbl_Hostel where (HostelID ='" + hmr.HostelID + "')";

Clean example:

INSERT INTO hostel_info(hostelName,rooms,capacity) 
SELECT HostleName, 'rooms', 'capacity'  
FROM tbl_Hostel 
WHERE (HostelID = 'id')
AleMonteiro 238 Can I pick my title?

It's not a good implementation what you're trying to do, and I don't know if it can be made like that, I think not.

I'd suggest one of two things: Either do it on the ItemDataBound event on your code behind OR, the easiest one, create a function that return the stock label.

Something like this:

Public Function GetStockLabel(ByVal qty As Int) As String

    If qty < 1 || null
    Then
        Return "Out of Stock"
    Else if qty < 5
        Return "Less than 5 available"
    Else
        Return "In Stock"
    End If

End Function

And call it like this inside <itemtemplate>:

<b><%# Eval("ProductName") %></b>
<%# GetStockLabel(Eval("CurrentStockQty")) %>
AleMonteiro 238 Can I pick my title?

Try this:

<html>
<head>
  <script>
  function CheckDivisors()
  {
     var 
        number=parseInt(document.divfrm.num.value),
        d=1,
        divisors = [];
     do
     { 
        if(number%d==0)
        {       
            divisors.push(d);
        }       
      d++;
     }
     while(d<=number/2);

     document.getElementById("divDivisors").value = divisors.join(", ");
  }
  </script>
  </head>
 <body>
 <form name="divfrm">
 Enter a number: <input type="text" name="num">
 <br>
 Divisors: <input type="text" name="div" id="divDivisors">
 <br>
 <input type="button" value="Display Divisors" onClick="CheckDivisors()">
</form>
</body>
</html>
`

It's not wise to make DOM changes inside a loop. DOM manipulation is heavy, so it's better to put gather all that you want to show and then show it all at once.

AleMonteiro 238 Can I pick my title?

HTTP Error 504 it's gateway timeout.

How are you trying to insert the data into the database?

You said you are using JS and ASP. The JS is reading the file and sending the data to the ASP server page to insert into the database? Is that right?
If so, then the your http request is pretty big and would take some time to complete.

Assuming you are using IIS, you can try to change the limits of the http request, like this:

<httpRuntime maxRequestLength="102400" executionTimeout="3600" />

This will set the max length to 100MB and the timeout to 60 minutes.

AleMonteiro 238 Can I pick my title?

I'd say jQuery UI. It's a great project, much used over the web, with lots of functionalities and it's has a great community.

I never joined the group, but I really respect and appreciate the job they're doing.

AleMonteiro 238 Can I pick my title?

Another option is to execute the function on page load, like this:

window.onload = function() {
    loadData();
};

Just a suggestion, instead of concat the ID's in different orders for the input and for img, wouldn't it be easier to add a sufix?
IE.:

// Set IDs
<td class="calendar-day">
    <input type="text" size=5 id="'.$parentID.'_'.$activityid.'_'.$mon.'"  class="timetracktb" />
    <img id="'.$parentID.'_'.$activityid.'_'.$mon.'_IMG" src="phpimages/trash.png" title="delete timelog" alt="trash icon"  />
</td>

// And to get the Img
var inputId = inputs[i].id;
var imgId = inputId + '_IMG';

Another thing, you don't have to add closing tags for <input> and <img>, they can close themselfs, like <img id="a" /> and <input id="b" />

Also, avoid using those inline styles. Use the css classes that you already have.

AleMonteiro 238 Can I pick my title?

Yes, it's a good idea to have a style sheet only for IE in your case.

You can do it like this:

<!--[if IE]>
    <link rel="stylesheet" type="text/css" href="all-ie-only.css" />
<![endif]-->

Take a look at this site for more info: http://css-tricks.com/how-to-create-an-ie-only-stylesheet/

AleMonteiro 238 Can I pick my title?

I don't know nivoSlider to help you out.

But you could take a look at others slider plugins:
http://webdesignledger.com/resources/8-responsive-jquery-slider-plugins

http://www.tripwiremagazine.com/2012/11/jquery-slider.html

AleMonteiro 238 Can I pick my title?

To my knowlodge, when you don't specify the width to 100% (last case) the browser takes care to make the child 100% of it's parent, including border and padding.

When you do specify width 100% (second case) you are saying that only the width must have 100%, without border and padding. So in the end the width will be the 100% of the parent plus border and padding.

And I think those implementaions depend on the browser.

Check those links to futher understanding:
http://www.w3schools.com/css/css_boxmodel.asp

http://www.daniweb.com/web-development/web-design-html-and-css/threads/442058/how-can-i-stretch-my-nav-bar-to-fit-width-of-browser-wothout-scroll-bar

http://css-tricks.com/the-css-box-model/

Smeagel13 commented: Clear and to the point, thanks. +2
AleMonteiro 238 Can I pick my title?

JorgeM, yes, you're right =)
My mistake

AleMonteiro 238 Can I pick my title?

After <div id="nav" style="float: right;"></div>
Insert <div style="clean: both;"></div>

AleMonteiro 238 Can I pick my title?

Just wrap the image and span into a <div>.

Then, if the div can't fit in the line it'll break to the next with the image and span inside it.

And to keep div's inline i use this css class, for browser compability:

.inline
{
    position: relative;
    display: -moz-inline-stack;
    display: inline-block;
    zoom: 1;
    vertical-align: top;

    *display: inline;
}
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?

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?

Are you using AJAX or posting forms?

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?

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?

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?

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?

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?

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?

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?

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?

Try using live:

 $(".replaced").live("click", function() {

    alert("Yeah!");

 });

Using 'click' will only attach handlers to existing objects. Using 'live' it'll attach the handlers to any existing object and also for objects created latter.