Not signed in (Sign In)

Vanilla 1.1.5a is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorpeterro
    • CommentTimeOct 9th 2007
     
    I have the repeat behavior working great on a few fieldsets. I am using ColdFusion so I had to change the default separator for the suffix from "-" to "_" as CF does not support "-" in the variable name. I changed the following lines in the wforms.js file:

    var suffix = "_" + rowCount.toString()
    wFORMS.idSuffix_repeatCounter = "_RC";
    wFORMS.idSuffix_duplicateLink = "_wfDL";

    I get the counter to show the proper number repeated sections, but when I remove one it does not detriment from the counter. Four adds and a remove still yield a repeat counter of 5.

    Any ideas.
    •  
      CommentAuthorcedsav
    • CommentTimeOct 10th 2007
     
    That's by design, see the section called 'sequence gap' here:
    http://www.formassembly.com/blog/wforms-server-side-handling-of-the-repeat-behavior-part-2/

    By the way. The new version of wForms (v3.0, not officially available yet) uses an array notation instead of the '-' separator. I don't know if that helps with ColdFusion, but let me know if you want to try it.
    You end up with something like this:

    fieldname[0] -> orignal field
    fieldname[1] -> first duplicate
    fieldname[2] -> second duplicate

    If you have nested repeats, you get something like this:
    fieldname[0][1]
    • CommentAuthorpeterro
    • CommentTimeOct 10th 2007
     
    Right after I posted I saw that post. I would love to try v3.0. Do you have a listing of improvements or changes handy? If not I can try to figure it out. Thanks.
    •  
      CommentAuthorcedsav
    • CommentTimeOct 10th 2007
     
    You can browse the repository here:
    http://svn.berlios.de/svnroot/repos/wforms/branches/3.0/

    Here's a quick overview of the changes:
    - There's a new calculations behavior for computed fields (see the test folder for examples).
    - The switch behavior now works on multi-page forms (i.e. you can skip pages)
    - wForms 3 uses Dean Edward's Base2 library.
    - Behaviors should be customizable more easily
    - Repeat behavior now uses the array notation [] (makes it easier to use with PHP)
  1.  
    Since this post was made, has anyone found a way to have the sequence detriment if a repeated section has been removed (example here under Team Roster: http://www.tfaforms.com/205163)?

    I have tried using both:

    <script type="text/javascript">
    wFORMS.behaviors.repeat.onRepeat = function(elem) {
    var m = wFORMS.behaviors.repeat.getMasterSection(elem);
    var i = wFORMS.getBehaviorInstance(m, 'repeat');
    var l = elem.getElementsByTagName('legend');
    var count = i.getSectionsCount();
    switch(count) {
    case 2:
    l[0].innerHTML = "1st prior";
    break;
    case 3:
    l[0].innerHTML = "2nd prior";
    break;
    case 4:
    l[0].innerHTML = "3rd prior";
    break;
    /* add cases as needed */
    }
    }
    </script>

    AND

    <script type="text/javascript">

    wFORMS.behaviors.repeat.onRepeat = function(elem) {
    var m = wFORMS.behaviors.repeat.getMasterSection(elem);
    var i = wFORMS.getBehaviorInstance(m, 'repeat');
    var count = i.getSectionsCount();

    var l = elem.getElementsByTagName('th');
    l[0].innerHTML += ""+count;
    }
    </script>




    Neither of these will detriment the sequence or move the section specifically titled headers up a row as sections are removed. I have two other questions related to this and repeated fields:

    1) Is there a way to shade every other duplicated section so that it looks nicer when many rows (sections) are added? - this would also need to change dynmatically as rows were removed
    2) Is there a way I can add a begining intiger in the original section but hide it or stop it from appending the header result in the duplicate sections? - so that I can label the first row with "1"


    By the way I will be embedding this on my own site, so I can edit the header/css/page code as required.


    Thanks!
    • CommentAuthordbuschho
    • CommentTimeMay 24th 2011
     
    Hello,

    I believe the answer is no to the above questions, but I'm entirely sure I understand what you are asking. Can you give us more detail on what you're trying to do?
  2.  
    If you browse to the form I linked above and look under the Team Roster section you will find a repeatable section which is used as input for members on a team. Click Add a few times and you will notice that the headers for each new line (section) add a sequencial number at the start of the line (ex: 2, 3, 4, 5, 6, 7, etc). Now, if a line is removed it will not keep the numbers sequential. The same is true for specific line titles such as instead of being 2, 3, 4, 5 have it specifically say member one, member two, etc. I am asking if any solution was found to have it keep the sequence even after removing repeated sections (lines of the table in this example).

    Also, adding a background shading to every other (every 2nd) line would be awesome to do. Same issues with removing the sections would exist however.

    And after adding a few lines, you will notice the first line does not have a title (1). The second line starts with 2, the third with 3 and so on. Is there a way to title the first line without it being repeated in the added sections? For instance, if I titled the section "1" and my code would add a 2 to the second line, the second lines title would show as "12" because it appends the results with the title of the original section. I want to be able to hide the default title for all sections other than the first so that the number sequence will begin with 1 and result in the 2, 3, 4, etc.

    Hope this explaination helps...
    • CommentAuthorhillaryw
    • CommentTimeMay 31st 2011
     
    Hello,

    Here is a forum on css wildcards that you may find helpful,
    http://www.webmasterworld.com/forum83/5871.htm
    You will find it in this form there
    a[title^="mytitle"] { styles }
    Here is a form with this implemented:
    http://www.tfaforms.com/205526


    The code below will alternate on static gridrow sections.
    <style type="text/css">

    .wForm form .alternate-0 td{
    background-color: #ffffff !important;
    }

    .wForm form .alternate-0 th{
    background-color: #ffffff !important;
    }

    .wForm form .alternate-1 td{
    background-color: #020202 !important;
    }

    .wForm form .alternate-1 th{
    background-color: #020202 !important;
    }
    </style>

    I hope this helps,
    Hillary