We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Multi Text

Development and Programming

stinhambo's avatar
stinhambo
1,268 posts
17 years ago
stinhambo's avatar stinhambo

I checked this thread to see if this question has been covered but nothing yet…

I have been asked to quote on a site that includes time sheet uploading where clients log in and create a new time sheet with details of their staff including hours worked and their IDs.

Multi-Text looks like a winner except they need to be able to output each Multi-Text entry as a comma delimited file to import into MYOB accounts. Is that possible with this extension?

If it is possible but not yet implemented then I would love to have a $ cost so I can quote appropriately.

       
james Brown's avatar
james Brown
492 posts
17 years ago
james Brown's avatar james Brown

a few people have mentioned it, but i dont know if there was a solution yet… Is there a way to check if a column is empty? Ex:

{if col_1!=""}

Also, did read somewhere correctly that errors occur if any fields are left blank?

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

Like ira42’s post above says, I too would like to sort the results on the template by one of the columns. I can think of two ways this could be done (totally riffing here, so I might be crazy):

  1. In the entry in the control panel by dragging the rows up and down (yay asynchronous Javascript) which I’m sure would be a significant rewrite.

  2. On the template level - maybe with the query module, or adding a new output parameter like:

<ul>
{members col_1="available" sortcol="col_2" sortorder="desc"}
<li><strong>{col_1}</strong>: {col_2}</li>
{/members}
</ul>

I’d then assume that the above would grab every line where {col_1} equals “available” and then sort them by {col_2}, descending.

I guess a significant problem would arise if one was trying to sort by numbers (in my real-life working-on-it-right-now case that would be square footage). I’m not sure how these fields are stored in the database but it’s some form of text I would guess.

I’d almost prefer the “drag to sort” method in the Control Panel, myself.

Any tips or tricks welcome, and I’ll post something here if I figure out anything interesting!

       
Bruce2005's avatar
Bruce2005
536 posts
17 years ago
Bruce2005's avatar Bruce2005

I must be missing something. Installed extension. Added a custom field called multi Named columns One Two Three to test.

Tried everything cannot get them to show in template.

Help please… Updated Jan 02, ok, figured it out…

       
F. Albrecht's avatar
F. Albrecht
75 posts
17 years ago
F. Albrecht's avatar F. Albrecht

I would like to say THANKS for Multi-text - cool extension 😊

Sorting for 1 col would be cool as a feature for the future.

Nevertheless Thumbs up!

2nd

       
MediaGirl Inc.'s avatar
MediaGirl Inc.
186 posts
17 years ago
MediaGirl Inc.'s avatar MediaGirl Inc.

Does anyone have an answer to this question?

Is

{if col_1!=""}

possible?

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

Yes, you can do that sort of thing. I actually have the very template open right now on which I’m doing that. What a coincidence! Note that to get it to work you might have to do it like this:

{if "{col_9}" != "" }

Actually - I don’t think you can keep any fields blank with this extension. I made it very clear to my client that they need to put a hyphen in any field for which they have no info - so I test against a hyphen.

       
MediaGirl Inc.'s avatar
MediaGirl Inc.
186 posts
17 years ago
MediaGirl Inc.'s avatar MediaGirl Inc.

Perfect!! Thank you a ton Ryan.

       
Silencio's avatar
Silencio
46 posts
17 years ago
Silencio's avatar Silencio

I keep getting stuck with this extension, it doesn’t seem to record empty rows or empty text fields.

Is it possible if I change the extension file to make it pre-populate each text field with a single letter such as “x” so that when the table is displayed I know what fields are empty.

What would I need to change?

I’d appreciate any help.

       
MediaGirl Inc.'s avatar
MediaGirl Inc.
186 posts
17 years ago
MediaGirl Inc.'s avatar MediaGirl Inc.

Try changing line #384 in ext.multi_text.php from

<code>$r .= "<input name=\"field_id_".$row['field_id']."_".$row_count."_".$i."\" value=\"";</code>

to

<code>$r .= "<input name=\"field_id_".$row['field_id']."_".$row_count."_".$i."\" value=\"X";</code>
       
MediaGirl Inc.'s avatar
MediaGirl Inc.
186 posts
17 years ago
MediaGirl Inc.'s avatar MediaGirl Inc.

Nevermind, my above solution doesn’t work perfectly. Let me look at it again.

       
Silencio's avatar
Silencio
46 posts
17 years ago
Silencio's avatar Silencio

grazie

it appears to work

       
MediaGirl Inc.'s avatar
MediaGirl Inc.
186 posts
17 years ago
MediaGirl Inc.'s avatar MediaGirl Inc.

It works correctly on a new entry, but not on an edited entry. It adds another dash in the fields for edited entries… at least it’s doing that on my end.

       
Silencio's avatar
Silencio
46 posts
17 years ago
Silencio's avatar Silencio
It works correctly on a new entry, but not on an edited entry. It adds another dash in the fields for edited entries… at least it’s doing that on my end.

Gotcha.

I did a bit of work on it with clear and blur fields and I got it to work.

I also got rid of it adding an extra row.

All the corrections I made are in the Publish function. I have to post these corrections in multiple messages because the character length requirements for this forum.

This is replacing the js starting on line 253

<code>function newMultiTextRow(reference, field)
                {
                    if(!document.getElementById) return false;
                    if(!document.getElementById("field_id_"+field+"_table")) return false;
                    
                    var table = document.getElementById("field_id_"+field+"_table").getElementsByTagName('tbody').item(0);
                    var trs = table.getElementsByTagName("tr");
                    var row_count =  reference.getAttribute("numRows"); // trs.length - 1;
                    var cells = trs.item(1).getElementsByTagName("td");
                    var cell_count = cells.length;
                    
                    var new_tr = document.createElement("tr");
                    for(i=0; i<cell_count-1; i++)
                    {
                        td = document.createElement("td");
                        input = document.createElement("input");
                        input.name = "field_id_"+field+"_"+row_count+"_"+i;
                        input.style.width = "100%";
                        input.value = "X";
                        input.onclick = "clickclear(this, 'X')";
                        input.onblur = "clickrecall(this,'X')";
                        td.appendChild(input);
                        new_tr.appendChild(td);
                    }
                    var del_td = document.createElement("td");
                        del_td[removed] = "<a href=\"#\" title=\"Remove Row\" onclick=\"removeMultiTextRow(this); return false;\">(delete)</a>";
                    new_tr.appendChild(del_td);
                    
                    table.appendChild(new_tr);
                    reference.setAttribute("numRows", Number(row_count)+1);
                }
                function removeMultiTextRow(anchor)
                {
                    if(!document.getElementById) return false;
                    if(!confirm("Are you sure you want to remove this row?")) return false;
                    
                    var table = anchor[removed][removed][removed];
                    var row = anchor[removed][removed];
                    
                    if(table.getElementsByTagName("tr").length == 2)
                    {
                        inputs = row.getElementsByTagName("input");
                        for(var i=0; i<inputs.length; i++)
                        {
                            inputs.value = "";
                        }
                    }
                    else
                    {
                        table.removeChild(row);
                    }
                }
                
                
                function clickclear(thisfield) {
                    if (thisfield.value == "X") {
                        thisfield.value = "";
                    }
                }

            function clickrecall(thisfield) {
                if (thisfield.value == "") {
                    thisfield.value = "X";
                }
            }</code>
       
Silencio's avatar
Silencio
46 posts
17 years ago
Silencio's avatar Silencio

And I changed this chunk around line 387 (with the new js):

for($row_count=0;$row_count<=count($data)-1;$row_count++)
            {
                $row_data = array();
                if(isset($data[$row_count]))
                {
                    $row_data = preg_split("/[\r\n]/", $data[$row_count]);
                }
                $r .= "<tr>";                
                for($i=0; $i<$columns; $i++)
                {                     $r .= "<td >";
                    $r .= "<input name=\"field_id_".$row['field_id']."_".$row_count."_".$i."\" value=\"";
                    if(isset($row_data[$i])) {
                        $r .= $row_data[$i];
                        if($row_data[$i]==''){
                            $r .='X';
                        }
                    }
                    else {
                        $r .='X';
                    }
                    $r .= "\" onclick=\"clickclear(this, 'X')\" onblur=\"clickrecall(this,'X')\" type=\"text\" style=\"width:100%;\" />";
                    $r .= "</td>";
                }
                $r .= "<td><a href=\"#\" title=\"Remove Row\" onclick=\"removeMultiTextRow(this); return false;\">(delete)</a></td>";
                $r .= "</tr>";
            }

Anyway it now works for what I need it to do.

Thanks for getting me started.

       
First 5 6 7 8 9 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.