DaveAmour 160 Mmmmmm beer Featured Poster

Is this not working, is there an error message?

DaveAmour 160 Mmmmmm beer Featured Poster

Does this help?

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>

    <style>
        .poster
        {
            width: 25%;
            height: 25%;
            position: absolute;
            margin-left: 20px;
            z-index: 0;
        }

        .poster img
        {
            -moz-border-radius: 50%;
            -webkit-border-radius: 50%;
            border-radius: 50%;
            height: 55px;
            width: 55px;
        }

        .poster a:nth-child(1)
        {
            position: relative;
            bottom: -57%;
            left: 33%;
        }

        .poster a:nth-child(2)
        {
            position: relative;
            bottom: -15%;
            right: -6%;
        }

        .poster a:nth-child(3)
        {
            position: relative;
            bottom: 18%;
            left: 10%;
        }

        .poster a:nth-child(4)
        {
            position: relative;
            top: 10%;
            right: -17%;
        }

        .poster a:nth-child(5)
        {
            position: relative;
            top: 55%;
            right: 7%;
        }

        .poster a:nth-child(6)
        {
            position: relative;
            top: -20%;
            right: -40%;
            height: 100px;
            width: 100px;
        }
    </style>
</head>
<body>
    <div class="poster">
        <a href="#"><img src='http://s2.blomedia.pl/gadzetomania.pl/images/2012/08/ceny-logo-2-304166.jpg' alt='' /></a>
        <a href="#"><img src='http://s2.blomedia.pl/gadzetomania.pl/images/2012/08/ceny-logo-2-304166.jpg' alt='' /></a>
        <a href="#"><img src='http://s2.blomedia.pl/gadzetomania.pl/images/2012/08/ceny-logo-2-304166.jpg' alt='' /></a>
        <a href="#"><img src='http://s2.blomedia.pl/gadzetomania.pl/images/2012/08/ceny-logo-2-304166.jpg' alt='' /></a>
        <a href="#"><img src='http://s2.blomedia.pl/gadzetomania.pl/images/2012/08/ceny-logo-2-304166.jpg' alt='' /></a>
        <a href="#"><img src='http://s2.blomedia.pl/gadzetomania.pl/images/2012/08/ceny-logo-2-304166.jpg' alt='' /></a>
    </div>
</body>
</html>
DaveAmour 160 Mmmmmm beer Featured Poster

What is a cycle image style? What's the page supposed to look like?

DaveAmour 160 Mmmmmm beer Featured Poster

Ok cool

DaveAmour 160 Mmmmmm beer Featured Poster

"how do we coincide this with the loading of the target page" - I've explained how - do you undersand what it is I am suggesting?

User clicks button
Posts to your page - persist data here
Page is rendered to user with form
Form automatically submits via JavaScript to other page
Otherpage does its stuff and redirects back to you
On final page grab username from however you stored it.

Ok?

DaveAmour 160 Mmmmmm beer Featured Poster

Ok I see.

How about instead of posting directly to this page, you post to your own page and this then posts to the other page. This has given you an extra trip to your server then you can choose from a multitude of options for persisting data.

The new intermedary page I am suggesting could render a page back to the user with Javascript which makes it post as soon as its loaded. The content of this page could be something sensible to let the user know something is being processed.

Another option is to use ajax. When the user clicks submit, before posting to otherpage, make a call to the server and again choose from your persistence options.

Make sense?

DaveAmour 160 Mmmmmm beer Featured Poster

You wrote:

"I do not redirect to the target page. "OtherPage" while doing its thing reads the hidden target variable from the request object and redirects to the target page."

The last part of this paragraph reads "and redirects to the target page".

Question - how do you redirect to the target page?

If you can't answer this time you will not hear from me again!

DaveAmour 160 Mmmmmm beer Featured Poster

"I was thinking I could create a database and the news feeds just draw on that?" - That's typically how this kind of thing works. You can write this yourself or use an off the shelf package. These are called CMS systems which stands for Content Management System

DaveAmour 160 Mmmmmm beer Featured Poster

Sorry I wasn't very clear. Let me summarise how I see things.

You have a page with a form which posts to "otherpage"

"otherpage" does some stuff and then "redirects to the target page that I send"

So my questionis how are you redirecting to this target page?

DaveAmour 160 Mmmmmm beer Featured Poster

How is redirection then done to "otherpage"?

DaveAmour 160 Mmmmmm beer Featured Poster

Ok cool.

I do MVC all day long so fire away if you have any questions.

DaveAmour 160 Mmmmmm beer Featured Poster

Hmm not sure really.

EF is normally installed via nuget though I think.

Sorry no idea about what else to downloadl.

DaveAmour 160 Mmmmmm beer Featured Poster

Hi Violet

It needs to restore many nuget packages. Do you have nuget installed and setup ok? Mine compiles ok after these have been restored.

DaveAmour 160 Mmmmmm beer Featured Poster

How are you redirecting to the other page?

Could you put the username in the a cookie?

DaveAmour 160 Mmmmmm beer Featured Poster

If you hit F12 in most browsers you will get some developer functionality. You can click on any element and then it will show you all they styles and where they are coming from etc - very useful for debugging CSS issues.

DaveAmour 160 Mmmmmm beer Featured Poster

Any chance of getting the entire app - zipped maybe?

DaveAmour 160 Mmmmmm beer Featured Poster

You can start by showing us your code!

DaveAmour 160 Mmmmmm beer Featured Poster

Your checkboxes have name attribute but need an id as well!

In jquery when you use # that looks for an id, not a name.

id tends to be used client side and name is what goes into postbacks. You can have both.

DaveAmour 160 Mmmmmm beer Featured Poster

Ok let me take a look...

DaveAmour 160 Mmmmmm beer Featured Poster

Please ignore my suggestion - I misread the quetion and read column instead of row for some reason!

DaveAmour 160 Mmmmmm beer Featured Poster

Just add them seperated with commas eg:

$sql1="UPDATE customer SET COMMENT='$_POST[COMMENT]', COMPANY = '$_POST[COMPANY]' WHERE MSISDN='$_POST[MSISDN]'";
DaveAmour 160 Mmmmmm beer Featured Poster

Ok so I don't do coldfusion so can't run your code but I can definatley fix this for you with a bit more info!

Can you show me a screenshot of these checkboxes and the rendered html - ie view the source in your browser.

Also what data can come back into text - is it always 2 numbers for example.

In plain English explain what these numbers should do with your checkboxes - I believe the code just isn't doing what you want so explain to me what the intent of your algorithm is and I can fix it.

DaveAmour 160 Mmmmmm beer Featured Poster

PS - here is the ValidationResult being used:

        public ValidationResult ValidateAddRebateRate(Rebate rebate, DateTime fromDate, DateTime? toDate, decimal rate)
        {
            var validationResult = new ValidationResult();

            //1. The fromDate cannot be before the start date of the rebate
            if (fromDate.Date < rebate.StartDate.Date)
            {
                validationResult.ValidationMessages.Add("The from date cannot be before the start date of the rebate to which it belongs.");
            }

            //2. If we have a to date then it must be after the from date
            if (toDate.HasValue && toDate.Value.Date < fromDate)
            {
                validationResult.ValidationMessages.Add("The to date must be after the from date.");
            }

            //3. If this is the first rebate to be entered, then the start date must be on or before the rebate start date
            if (rebate.RebateRates.Count == 0 && fromDate > rebate.StartDate)
            {
                validationResult.ValidationMessages.Add("Since this is the first rate to be added to this rebate, the from date must be on or before the rebate start date. The actual rebate start date is ");
            }

            //4. If there are already existing rates, then the from date must be greater than the max existing from date of all rates apart from those with a status of rejected
            if (rebate.RebateRates.Any(r => r.Status != RebateRateStatus.Rejected) && fromDate <= rebate.RebateRates.Where(r => r.Status != RebateRateStatus.Rejected).Max(r => r.FromDate))
            {
                validationResult.ValidationMessages.Add("The from date must be after the from dates of all existing rates (not counting those which have been rejected).");
            }

            //5. If there are no existing rates and a toDate is supplied then this is not allowed - supress on the UI alsp
            if (toDate.HasValue && …
DaveAmour 160 Mmmmmm beer Featured Poster

Hi

I'm not a PHP developer but do have good OOP skills.

Loose coupling is certainly key.

Have your validation class return an instance of ValidationResult (a class you will define unless there already is one in PHP?). This could be an instance of a class which has a boolean IsValid property and a colletion of string messages.

Don't have any html tags in your messages as you can reuse this class again and again - maybe in another app which doesn't use html.

SOLID is an acronym of good OO practice. The S stands for Single Responsibility principle which essentially just means that a class should only do one type of thing. In my programming language which is C# I have a ValidationResult class like this:

    public class ValidationResult
    {
        public bool IsValid
        {
            get
            {
                return !ValidationMessages.Any();   
            }
        }

        public List<string> ValidationMessages { get; set; }

        public ValidationResult()
        {
            ValidationMessages = new List<string>();
        }
    }

Hope that helps.

DaveAmour 160 Mmmmmm beer Featured Poster

Ok let me check in the monring, off to bed now.

DaveAmour 160 Mmmmmm beer Featured Poster

Look at the difference between your code and mine:

for (var i = 0; i < roleInfoLength; i++)
{
    $('input#grant_AppId' + i).prop('checked', true);
    $('input#revoke_AppId' + i).prop('checked', false);
}



for (var i = 0; i < roleInfoLength; i++)
{
    $('input#grant_AppId' + roleInfo[i]).prop('checked', true);
    $('input#revoke_AppId' + roleInfo[i]).prop('checked', false);
}

Ie roleInfo[i] instead of just i

DaveAmour 160 Mmmmmm beer Featured Poster

Ok this is an educated guess rather than having actually worked through it properley but do you need the code below instead?

            for (var i = 0; i < roleInfoLength; i++)
            {
                $('input#grant_AppId' + roleInfo[i]).prop('checked', true);
                $('input#revoke_AppId' + roleInfo[i]).prop('checked', false);
            }
DaveAmour 160 Mmmmmm beer Featured Poster

Ok let me have a tinker...

DaveAmour 160 Mmmmmm beer Featured Poster

Ok right that is what $('p#testing').html(text) is for.

Can you show me the html of your checkboxes?

DaveAmour 160 Mmmmmm beer Featured Poster

Or if that's too much work and since I have done it already you can download it from my site @ www.paxium.co.uk/content/MVA-Introduction-to-ASPNET-MVC-master.zip

DaveAmour 160 Mmmmmm beer Featured Poster

trim used like that does not exist in native javascript - maybe the other article had a trim function in there?

DaveAmour 160 Mmmmmm beer Featured Poster

Have you debugged it? Is roleCallback actually getting called and if so what is the value passed into it?

DaveAmour 160 Mmmmmm beer Featured Poster

http://www.paxium.co.uk/content/daniweb/trim.html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
</head>
<body>
    <form>
        <input type="text" id="test" />

        <br />
        <br />

        <input type="button" value="Show Trimmed Text"  onclick="showTrimmedText();" />
    </form>

    <script>
        function showTrimmedText()
        {
            var value = document.getElementById("test").value.trim();

            alert("[" + value + "]");   
        }
    </script>
</body>
</html>
DaveAmour 160 Mmmmmm beer Featured Poster

Looks ok at a glance - are you able to provide some html as well so I can have a play? Also an example of what text contains when the function is called.

DaveAmour 160 Mmmmmm beer Featured Poster

Youre welcome

DaveAmour 160 Mmmmmm beer Featured Poster

Do you have a Git account?

If not create one and sign in.

Go to the link you gave and click on Fork (top right)

Then click on Download Zip. Save and unzip open the parent folder then open the next folde then open the MVCMusicStoreFolder and double click on the Sln file and you should be good to go.

DaveAmour 160 Mmmmmm beer Featured Poster

Thats ok but variables have scope. In C# if you declare a variable inside { } then it can only be used there. You need to declare it elsewhere as below:

using System;
using System.Web.UI.WebControls;
using System.Net.Mail;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Net;
using System.IO;

public partial class SendMail : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            Response.Write("<br>Page has been posted back.");

            //send payment info to api, send them an email, go to thank you page

            var ccex = Request.Form["ExpMon"] + Request.Form["ExpYear"];
            var date1 = System.DateTime.Now.ToString();
            var pt = Request.Form["plantype"];
            string theamount;

            Response.Write("<BR>ccex = " + ccex);

            Response.Write("pt.ToString() = " + pt.ToString());

            if (pt.ToString() == "Gold")
            {
                theamount = "150.10";
            }
            else
            {
                theamount = "205.08";
            }

            String post_url = "XXX/transact.dll";

            Dictionary<string, string> post_values = new Dictionary<string, string>();

            post_values.Add("x_login", "XXX");
            post_values.Add("x_tran_key", "XXX");
            post_values.Add("x_delim_data", "TRUE");
            post_values.Add("x_delim_char", "|");
            post_values.Add("x_relay_response", "FALSE");

            post_values.Add("x_type", "AUTH_CAPTURE");
            post_values.Add("x_method", "CC");
            post_values.Add("x_card_num", Request.Form["ccnum"]);
            post_values.Add("x_exp_date", ccex);

            post_values.Add("x_amount", theamount);

            post_values.Add("x_description", "Plan Purchase: " + Request.Form["plan"] + ": " + Request.Form["plantype"]);

            post_values.Add("x_first_name", Request.Form["fname"]);
            post_values.Add("x_last_name", Request.Form["lname"]);
            post_values.Add("x_address", Request.Form["addr"]);
            post_values.Add("x_email", Request.Form["emaila"]);
            post_values.Add("x_state", Request.Form["state"]);
            post_values.Add("x_zip", Request.Form["zip"]);
        }
    }
}
DaveAmour 160 Mmmmmm beer Featured Poster

"I'm not sure what the requirements are" - I couldn't figure that out too!

DaveAmour 160 Mmmmmm beer Featured Poster

Ok this won't help with this problem but you should have an automatic backup job which backs up every day - it can be set to delete them when they are older then a set time - eg 4 weeks.

Its a 5 minute job to set this up, unfortunaley people only learn the hard way!

DaveAmour 160 Mmmmmm beer Featured Poster

Fiddler is also a great tool for debugging ajax calls.

Szabi Zsoldos commented: fiddler is the best for me also :) +5
DaveAmour 160 Mmmmmm beer Featured Poster

You can even make your CSS more concise - put all your float left in on the line 36 section for example.

DaveAmour 160 Mmmmmm beer Featured Poster

http://www.paxium.co.uk/content/daniweb/divclear.html

<html>
<head>
    <title>untitled</title>
    <style type="text/css">
        body
        {
            font-family: sans-serif;    
        }

        p
        {
            clear: left;    
        }

        #boxA
        {
            float: left;
        }

        #boxB
        {
            float: left;
        }

        #boxC
        {
            clear: left;
            float: left;
        }

        #boxD
        {
            float: left;
        }

        #boxA, #boxB, #boxC, #boxD
        {
            border: 1px solid green;
            text-align: center;
            line-height: 100px;
            margin: 10px;
            width: 100px;
            height: 100px;
        }
    </style>
</head>
<body>
    <p>First Row</p>
    <div id="boxA">Box A</div>
    <div id="boxB">Box B</div>
    <p>Second Row</p>
    <div id="boxC">Box C</div>
    <div id="boxD">Box D</div>
</body>
</html>
DaveAmour 160 Mmmmmm beer Featured Poster

I don't know anything about those objects but my tip would be to consider the Liskov substitution principle in making your decision.

ddanbe commented: Thanks for the tip. +15
DaveAmour 160 Mmmmmm beer Featured Poster

You could do it like this

            string[] wibble = { "AAAA", "BBB,B", "CCCCC" };

            Console.WriteLine(CommaCount(wibble.ToArray()));

Or like this:

        public static int CommaCount(string[] sarray)
        {
            var copy = sarray.ToArray();

            int count = 0;
            int commas = 0;

            for (int i = 0; i < copy.Length; i++)
            {
                commas = copy[i].Count(c => c == ',');

                if (commas > count)
                {
                    count = commas;
                }
            }

            return count;
        }
DaveAmour 160 Mmmmmm beer Featured Poster

You are declaring your variable inside the curly brackets. This is the scope of the variable.

Move it onto line 25 with

string theamount;

then assign it in your if statements as you are but remove the "var "

DaveAmour 160 Mmmmmm beer Featured Poster

Hi

This is indeed a Generic List.

You can create a List of anything eg List<Customer> or List<Invoice>

To Add things you just use:

var model = new StoreIndexViewModel();

model.Genres.Add("Horror");
model.Genres.Add("Romance");
model.Genres.Add("Drama");

You can pull them all out with things like:

foreach (var genre in mode.Genres)
{
    //Do something with genre here
}

Why is this better than an array? Many reasons. Check out this video:

https://www.youtube.com/watch?v=J9Cwi45UtZU

DaveAmour 160 Mmmmmm beer Featured Poster

And finally

There are only 10 types of people. Those who understand binary and those who don't.

DaveAmour 160 Mmmmmm beer Featured Poster

Or sometimes in real production code I have been know to use silly variables like Underpants particularly with foreach...

foreach (var item in pairOfUnderPants)
{

}
DaveAmour 160 Mmmmmm beer Featured Poster

Not a joke as such but one I use a lot.

"Ahh that' would be a PICNIC error"?

Problem In Chair, Not In Computer.

DaveAmour 160 Mmmmmm beer Featured Poster

Youre welcome. I also added return true since you were not doing that.