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 lets break this down one thing at a time. Firstly how/when do you want this code to be invoked? Also what style of Ajax are you using - hand written with jquery, some kind of other library maybe?

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
<div class="wibble">1</div>
<div class="wibble">2</div>
<div class="wibble">3</div>
DaveAmour 160 Mmmmmm beer Featured Poster

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

DaveAmour 160 Mmmmmm beer Featured Poster

Ids should be unique. use class instead

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

Which programming language/version are you using?

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

Another thought about security - you realise that a user can easily change the value themselves - this isn't a real ecommerce site or anything like that is it?

How can you use ajax? Depends - have you used it elswhere on your site yet?

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

Ok then you use some javascript to read its value and make an ajax call to update it on the server.

If this is the only item on the page with a class of GrandTotal I would possibly give it id="GrandTotal" instead.

You can then access that via script and send it to a server side method to insert it into the database via ajax. Do you do any other ajax in your app?

DaveAmour 160 Mmmmmm beer Featured Poster

ring.jpg

This post has no text-based content.
DaveAmour 160 Mmmmmm beer Featured Poster

Ok and is the span content being changed somehow after the page is loaded?

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

I aksed you an either or question.

Eg do you want tea of coffee?

You answered yes - do you see how that causes me a problem?

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

Do you want to do this via ajax/javascript or via a traditional form posting?

DaveAmour 160 Mmmmmm beer Featured Poster

Youre welcome.

DaveAmour 160 Mmmmmm beer Featured Poster

Maybe he is drowning?

DaveAmour 160 Mmmmmm beer Featured Poster

I think he/she means how not who!

God knows about the 42 though!?

DaveAmour 160 Mmmmmm beer Featured Poster

Youre welcome

DaveAmour 160 Mmmmmm beer Featured Poster

Good, now re-read my original comments and it will all make sense!

DaveAmour 160 Mmmmmm beer Featured Poster

Ok sorry wasn't paying attention there!

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

Its ok for me. What browser are you using?

DaveAmour 160 Mmmmmm beer Featured Poster

Ok I see - but what is your actual question?

DaveAmour 160 Mmmmmm beer Featured Poster

Ok I see

DaveAmour 160 Mmmmmm beer Featured Poster

Not sure what you are asking - can you elaborate please?

DaveAmour 160 Mmmmmm beer Featured Poster

Fair enough. I don't know much about regex but I always remember the hat and dollar so could have answered this one!

DaveAmour 160 Mmmmmm beer Featured Poster

Ha ha yes but yours is not 4 feet long!

DaveAmour 160 Mmmmmm beer Featured Poster

This is off the top of my head but open the xml in design view and the maybe just right click on the node you want and it should be there - if not I shall have to download it and have a look.

DaveAmour 160 Mmmmmm beer Featured Poster

Hi and Welcome

DaveAmour 160 Mmmmmm beer Featured Poster

ZZTop - Too beardy for me!

DaveAmour 160 Mmmmmm beer Featured Poster

@overwraith - I think you can do that without an if statement - in the actual requirements we have numbers going up and down hence the if statement maybe?

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

Talking to yourself?

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

typo alert - you put "start" gazing!

DaveAmour 160 Mmmmmm beer Featured Poster

please wait until current program is uninstalled - might need a reboot.

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>