SitePoint Sponsor

User Tag List

Page 2 of 13 FirstFirst 12345612 ... LastLast
Results 26 to 50 of 310
  1. #26
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Could it be that $("#dropLocationFromName") is not the correct reference to the element?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  2. #27
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    Can you correct me here on how to get the correct reference? Am I on the right path itself or totally wrong there?

  3. #28
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by newtomysql View Post
    Can you correct me here on how to get the correct reference? Am I on the right path itself or totally wrong there?
    It seems that you are on the right path. What is the identifier added select field?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  4. #29
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    I am not sure with the indentifier I guess this is what you are asking var dropLocationFromName = 'locationFrom[' + id + ']';. Thus the indentifier should be the id to make it unique each row.

  5. #30
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by newtomysql View Post
    Dear Paul,
    I am not sure with the indentifier I guess this is what you are asking var dropLocationFromName = 'locationFrom[' + id + ']';. Thus the indentifier should be the id to make it unique each row.
    Then it seems that $("#dropLocationFromName") should be that instead, which might be achieved with:

    $('#' + dropLocationFromName)
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  6. #31
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    Even I have change like your advice I still get this error

    element is undefined
    var settings = $.data(element.form, 'validator').settings;

  7. #32
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by newtomysql View Post
    Dear Paul,
    Even I have change like your advice I still get this error

    element is undefined
    var settings = $.data(element.form, 'validator').settings;
    The work we're doing here is similar to gardening. There is no one-stop-shop solution. Instead, we gradually work our way towards a solution, working through things bit by bit, issue by issue at a time.

    The error message that you got means that the validator cannot seem to find the field that you want to add. Why not?

    Does the new select field have the identifer that we expect it to have? Check and find out.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  8. #33
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    Sorry I am kind of lost. I woud expect that after this line $("#dynamicRow").find('tbody').append(prot); the field should be in. How to check beside I am able to see it on the screen. Any idea how to other check?

  9. #34
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by newtomysql View Post
    Dear Paul,
    Sorry I am kind of lost. I woud expect that after this line $("#dynamicRow").find('tbody').append(prot); the field should be in. How to check beside I am able to see it on the screen. Any idea how to other check?
    That depends on the web developer tools that you have available.
    Are you using Google Chrome, Firefox with Firebug, Internet Explorer (which version?), or something else?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  10. #35
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    I got Internet Explorer and also Firefox with firebug. What and how should I do the testing. Thank you.

  11. #36
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by newtomysql View Post
    Dear Paul,
    I got Internet Explorer and also Firefox with firebug. What and how should I do the testing. Thank you.
    With Firefox (and Google Chrome) you can right-click on the element and select Inspect Element

    With Internet Explorer it's not quite as easy. You press F12 for the developer tools, and in the HTML section you can drill down through the DOM tree to the appropriate element.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  12. #37
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    Ok exactly at the element I got this from the inspect element. So I notice missing the id="locationFrom[]"? Am I right?

    <td>
    <div id="parentDivLocationFrom">
    <select id="locationFrom[]" class="required error" name="locationFrom[1]">
    <div id="labelLocationFromError"></div>
    </div>
    </td>

  13. #38
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by newtomysql View Post
    Ok exactly at the element I got this from the inspect element. So I notice missing the id="locationFrom[]"? Am I right?
    That's right.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  14. #39
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    I got it done. But I got one problem now each time a row is added the error message appear before the use can even pick any select value how to avoid if the user might feel annoyed. Thank you.

  15. #40
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    There is problem on IE the same error still appears. Even in Firefox the error is there but the Validation Message keep appearing too.

  16. #41
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by newtomysql View Post
    Dear Paul,
    I got it done. But I got one problem now each time a row is added the error message appear before the use can even pick any select value how to avoid if the user might feel annoyed. Thank you.
    That may be happening due to the validate part within the add function. Now that you're adding the new field, try removing the validate part from just before it and see what happens.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  17. #42
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    Still the same. Even I have removed that too.

  18. #43
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Then it seems we've learned that explicitly adding rules triggers the validation.
    Is that even needed? Is the field automatically handled even if you don't explicitly add a rule for it?

    The root cause of the initial problem may-well have been the non-unique name of the form field, which is now fixed.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  19. #44
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    You are right it does not need the additional rules. My next question is since now I am using the class=required how am I going to use my .css classes? Any idea?

  20. #45
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by newtomysql View Post
    You are right it does not need the additional rules. My next question is since now I am using the class=required how am I going to use my .css classes? Any idea?
    As long as your CSS classes don't clash with those used by the validator, things should be fine.

    Do you experience a problem with your CSS classes?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  21. #46
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    For instance if I got my own class name can I apply as below. The problem there will be 2 classes? I dont think so this is right?

    <td>
    Route Nameinput class="required" class="text" type="text" name="routeName" id="routeName" value="" />

    </td>

  22. #47
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by newtomysql View Post
    For instance if I got my own class name can I apply as below. The problem there will be 2 classes? I dont think so this is right?
    You can have more than one class on an element. You separate them by a space.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  23. #48
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    Thank you that worked perfectly. Another thing I want to know more about the validate function. So once it is called what exactly it will do? Will it be called each time the page load and how is it control on submission only?

  24. #49
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,718
    Mentioned
    103 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by newtomysql View Post
    Another thing I want to know more about the validate function. So once it is called what exactly it will do?
    According to the .validate() documentation page, it "sets up event handlers for submit, focus, keyup, blur and click to trigger validation of the entire form or individual elements"


    Quote Originally Posted by newtomysql View Post
    Will it be called each time the page load
    That's the way things normally work. The page loads, and a script is run to enhance the user experience.

    Quote Originally Posted by newtomysql View Post
    and how is it control on submission only?
    This section of the .validate() documentation seems to explain that with some quite good detail.
    A few things to look for when playing around with the demo
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  25. #50
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    874
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Dear Paul,
    I have modified a bit my codes now with this function in it. What I want to check is that the rows of the id="dynamicRow" should be more than 2 then only I want to validate? I dont know how to the rows only for that table?

    function checkRows(form) {
    //$(form).validate().resetForm();
    alert("Length : "+$('tbody tr', form).length);
    if ($('tbody tr', form).length > 2) {
    alert("Call setup multiple row");

    }
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •