Jump to content

vijdev

Members
  • Posts

    109
  • Joined

  • Last visited

    Never

Posts posted by vijdev

  1. i have a problem wth the area in processData() area below.

    what my code does is...

    1. takes input via form

    2.gets success from a post

    3.displays latest form input that was submitted to the server DB

    4. asks for add another

    5. as you add another, it goes on appending all recent adds to server (processData()) to show as a cue

     

    problem:

    first add is ok

    second add, appends the input twice.

    3rd add appends the input thrice..etc... and so on.

    but it must be once only!

     

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Manager</title>
    <link rel="stylesheet" type="text/css" href="../css/style.css"/>
    <script type="text/javascript" src="../scripts/jquery-1.4.4.min.js"></script>
    
    <script type="text/javascript">
    
    $(document).ready(function(){
        var g_ID=$('#in').val();
        $('#div_add').hide();
        $('#res').hide();
        $('#recent').hide();
        $('#action2').hide();
        $('#action3').hide();
        $('#fail').hide();
        $('#errorlist').hide();
        
        $('#action1,#action2').click(
        function(){
            $('#action1,#action2,action3').hide();
            $('#fail').hide();
            $('#errorlist').hide();
            $('#in').val('');
            $('#div_add').show();
            $('#in').focus();
            $('#res').hide();
            $('#recent').hide();
            
            $('#form_add').submit(
            function(){
                
    var formData = $(this).serialize();
       $.post('baseload.php',formData,processData);
        function processData(data) {
          if (data==' Added!') {
            if (!$('#result').length) {
             $('#res').prepend('<span id="result">...  Added!!</span>');
             }
            if (!$('#rec').length) {
             [color=red]$('#recent').append("<span id='rec'> Added: ");        $('#rec').append(g_ID);        $('#recent').append("</span>");        }        else{            $('#rec').append(",");            $('#rec').append(g_ID);            $('#rec').append(".");        }[/color]
             $('#errorlist').hide();
             $('#res').show();
             $('#recent').show();
             $('#div_add').hide();
             $('#action1').hide();
             $('#action2').show();
             $('#action3').show();
             $('#fail').hide();
             return false;
             }
           else { 
             if (! $('#fail').length) {
               $('#div_add').prepend('<span id="fail">Incorrect  information. Please try again</span>');
            return false;   }
          
           }return false;
        }
        
    
    
    //end not empty-redundant brkt
        
    return false;}//end submit function
    )//end submit
            
            
        }//end click function
        ) //end click action1,action2
    var url='home.php';    
    $('#action3,#action4').click( function()
    {
    location.reload();   
    }
    );
    
        
    }//end doc ready func{}
    );//end ready()
    
    
    
    
    </script>
    </head>
    <body>
    
    <a href="#div_add" class="common" id="action1" title="Add an " accesskey="a">Add !</a>
    
    
    
    <div id="div_add" title="Add !">
    
            <form action="baseload.php" id="form_add" name="form_add" method="post" title="Add  to DB">
                <input type="text" id="in" maxlength="200" size="70" title=" In" name="base" />
                <input type="submit" name="b_info" value="Check-In!" id="b_info" />
            <button class="common" id="action4" title="Home" accesskey="h">Cancel!</button>
            
                
                <span id="errorlist" class="errors"></span>
            </form>
            
            <br />
    </div>
    
    
    <div id="res">
    <br />
    <button class="common" id="action2" title="Add another " accesskey="a">Add Another </button>
    <button class="common" id="action3" title="Home" accesskey="h">Am Done for now!</button>
    </div>
    <div id="recent" class="recent">
    
    </div>
    </body>
    </html>
    
    
    

  2. Without having any access to your CSS my only guess is that some style is being applied and you can only override it by using an inline style.

     

    I have pasted the CSS in my first post above.

     

    Here's a status update - I have uninstalled all extensions, reinstalled both browsers, turned off mcafee firewall..

    Still the same problem!!!!It is only with linked CSS, and only with chrom and firefox, not with IE linked CSS..

    @WTFranklin - i understand what you mean but am quite unwilling to let go of the versatility, and not convinced why!!!!

  3. html:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Manager</title>
    <link href="../css/style.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    
    <div id="div_add" title="Add!" class="errors">
    
            <form action="load.php" id="form_add" name="form_add" method="post" title="Add to DB">
                <input type="text" id="in" maxlength="200" size="70" title="In" name="base" />
                <input type="submit" name="b_info" value="Check-In!" id="b_info" />
            </form>
    </div>
    </body>
    </html>
    
    

     

    css:

    .errors{
    border-style: dashed;
    }
    
    

  4. i would still like to see:

    mysite.fr/articles/name_of_the_article

    instead of:

    mysite.fr/articles.php?name=name_of_the_article

    or

    mysite.fr/articles.php?num=9

    or

    view.php?name=blabla

    (from db point of view basically article id number will have an article title linked to it in the same row...)

    can anyone help?

    RAD!S solution "works", but not what am looking for!

  5. the thing is am still a sub-novice at jquery or any ajaxy things..

    so was wondering abt iframes...

    i know ajax is the ultimate final destination.

    any alternatives until then?..why do you say NO to iframes?..is it so dangerous and messy?

     

    and if not ajax and if not iframes..anything else?

  6. must we always use Transactions in php-mysql applications?

    i kind of made a self-discovery for a problem i was trying to solve....and found that mysql transactions would solve my problem.

    i wanted a set of SQLs to all be executed, or none an with undo of partial successful updates.

    is this transactions the standard way, and is this a must-do for realtime applications?

    any pros/cons/advise?

    thanks!

  7. "vijdev and 0 Guests are viewing this topic."

     

    can someone help me with a pointer on how to get started with something like the above message when viewing different pages in the site...it must be page/topic specific.

    is this using sessions/cookies/databases?...?

  8. can i do something like this?

     

    <?php
    switch ($i) {
        case 0:
            echo "i equals 0";?>
    ////////////// html stuff ////////
    <?php
            break;
        case 1:
            echo "i equals 1"; ?>
    ///////////////////html stuff//////////////
    <?php
            break;
        case 2:
            echo "i equals 2"; ?>
    ////////////html stuff///////////////
    <?php
            break;
    }
    ?>

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.