Jump to content

php7Q

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Posts posted by php7Q

  1.  

    You see where the function is being triggered; with the onchange() event, in the input text field? All you need to do is remove the onchange event from the input text field and add the "ajaxFunction()" to a button (that has an onclick event).

     

    Example:

     

    <input type="button" onclick="ajaxFunction()" value="Submit">
    

  2.  

    You would then do a little something like this:

     

    <script language="javascript">
    function valsub()
    {
    var field = document.getElementById('msg').value;
    var field2 = document.getElementById('msg2').value;
    var field3 = document.getElementById('msg3').value;
    if (field.length == 0 || field == null && field == "")
    {
    document.getElementById('btn').disabled = true;
    }
    else if (field2.length == 0 || field2 == null && field2 == "")
    {
    document.getElementById('btn').disabled = true;
    }
    else if (field3.length == 0 || field3 == null && field3 == "")
    {
    document.getElementById('btn').disabled = true;
    }
    else {
    document.getElementById('btn').disabled = false;
    }
    }
    </script>
    
    <form action="test.php">
    <input id="msg" name="message" type="text" onkeyup="valsub()" />
    <input id="msg2" name="message2" type="text" onkeyup="valsub()" />
    <input id="msg3" name="message3" type="text" onkeyup="valsub()" />
    <input id="btn" type="submit" name="Submit" value="Submit" disabled />
    </form>
    

     

    I mean, there are other ways to go about do that; but using my original example above - you would do something like this.

  3.  

    I assume your doing this with AJAX or that jQuery is doing this with AJAX. I would set the pagination up where it would display some where else; instead of in your "main" div. Otherwise you will have to create another AJAX function for the pagination too load the php page back into your div; instead of reloading the page. Even if your pagination is outside your "main" div; your probably going to need to have a AJAX function for your pagination anyway (that's my guess).

  4.  

    Here you go Tom; try this out and see how it works out for you. :)

     

    <script language="javascript">
    function valsub()
    {
    var field = document.getElementById('msg').value;
    if (field.length >= 1 && field != null && field != "")
    {
    document.getElementById('btn').disabled = false;
    }
    else {
    document.getElementById('btn').disabled = true;
    }
    }
    </script>
    
    <form action="test.php">
    <input id="msg" name="message" type="text" onkeyup="valsub()" />
    <input id="btn" type="submit" name="Submit" value="Submit" disabled />
    </form>
    

     

     

×
×
  • 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.