views:

245

answers:

1

I have multiple text files, which are simple reports, that must be reviewed and validated by users. I would like to pull the report into an html div element then add form fields at absolutely positioned locations.

For example, the report may have monthly sales by sales rep:

Jan    Feb    Mar
 13      9     11

I want the user to see that, and an input type="text" element after the row of sales numbers. The user would have to enter their initials to confirm the numbers. At that point, I would actually modify the text file to show their initials (as well as set some flags in the database).

I am looking for some ideas - premade solutions please. The site is built using PHP and JQuery, with some cgi perl scripts as well. So solutions involving any of those would be great.

Thanks.

+1  A: 

It looks like you're going to need a bit of file() (see Example #1) and some of jQuery.ajax() (i recommend actually using .get() or .post() instead of .ajax())

Then you'll probably want to return some json from php, and put the elements from json into either some pre-rendered text fields with

$("input[type=text]").each(function(){
    // some looping through each json element to insert things where they should be
    // probably need something with .val(default_value_of_textbox)
}

alternately you can echo pre-formatted html from the php script and just insert it with the ajax callback function:

$.post("you_page.php", {option: "world"}, 
    function(data){
        $("#your_div").html(data);
    }, "html");

Then make a similar ajax call with the updated information, and do some validating server side.

contagious