Checkbox element - how to make no checkboxes until user adds them

Bren

Member
Hello all.

I have a form where the user would need to add 1 or more checkbox's to and then later check off the checkbox's. I think the checkbox element with the option for the user to add checkbox's will work; but I need the initial 1st checkbox to not automatically be there. I only need the add option in case the user adds any. Also, when the user adds the checkboxes the default of the added checkbox's needs to be unchecked. Is this possible?
Thanks in advance.
 
Cool. I didn't think of that. Thanks Troester.
Going that route I'll have to create a sub list to reference. Is it possible for each record to start with a new empty sub list? I'm trying to prevent the user from having to search through a long growing list.
Thanks in advance.
 
You can achieve that by adding a user element to the lookup list, so when a user adds an entry it has their userid. Then add a pre-filter on the list as ...

WHERE
Field: userid
Condition: EQUALS
Value: {$my->id}
Type: text

That way, users will only see "their own" entries.

-- hugh
 
Cool. Thank you, Hugh.
If I want other users to see the same items; can I do something similar with the parent record ID (versus my->ID)?
Thanks in advance.
 
Maybe. Kind of depends what you are trying to do. Can you explain in more depth.

Also, I misspoke, the filter would have to be on the element itself, in the Where fuller, not a prefilter on the lookup list. Like...

WHERE {thistable}.userid = {$my->id}

Sent from my HTC6545LVW using Tapatalk
 
Sure. I have a user who has been entering order #s in a text field element and then later updates an order ready date field element when all of the orders have arrived. Then a 2nd user receives an automatic email when this date ready field element has a value. The problem is that the 2nd user has been noticing that the 1st user has failed a few times with making sure all of the orders were received completely before updating the date ready field element. So, the 2nd user asked if I could add some more validation to the order number field by changing it to one or more checkboxes that the 1st user adds on the fly. I should also say that the parent record (which has one or more orders within it) is a single job or project. The 2nd user schedules each job only if all of the related orders have arrived first.
I hope that helps. Thanks in advance.
 
Last edited:
OK. Well, I tried to apply your suggestion (I think in the right place). I'm trying to make the dbjoin list items only appear in the records that they were created within. Attached is a snippet / screenshot of my attempt in the DBJoins Data - Where settings. It didn't work. When I added a couple checkboxes it appeared in all other record forms (per the 2nd attached snippet / screenshot). Any suggestions?
Thanks in advance.
 

Attachments

  • DBJoin Filter Where.JPG
    DBJoin Filter Where.JPG
    26.8 KB · Views: 64
  • Checklist test on form from any record.JPG
    Checklist test on form from any record.JPG
    10.4 KB · Views: 62
The rowid is in the column parent_id and you must use the "Joins where and/or
order by statement (SQL)" field
I didn't test but try
WHERE {thistable}.parent_id={rowid}
 
Thanks Troester. I tried it, per the attached, and as soon as I open the related form I receive than error (2nd attachment). Not sure why.
Any suggestions.
 

Attachments

  • DBJoin Joins Where.JPG
    DBJoin Joins Where.JPG
    37.4 KB · Views: 66
  • Error.JPG
    Error.JPG
    78.6 KB · Views: 63
Wish I knew the solution to this. I've tried the following and all it does is make all my check boxes go away.
WHERE {thistable}.id={rowid}
Basically, I'm just looking for checkboxes added within a form / edit to save to the related record and be visible to all users. Any suggestions?
Thanks in advance.
 
Hello All.
It took some extra work; but I got the following to work.
WHERE {thistable}.fid={rowid}
I had to add another field element to my lookup table called fid. I also added a PHP plugin to the form that saves the parent records ID to a session variable and some PHP to the default of the hidden fid field element to save the session variable to it. So, my database join checkboxes now work perfect when editing an existing parent form. Unfortunately, an error page appears (similar to the previous threads) when adding a new parent form record (obviously because the fid can't be loaded without an ID to lookup, yet). So, I'm forced to choose the "Edit" option in the "Apply where when" setting in the database join element to prevent the error page. I would finally be done if I could somehow hide the database join element in the form only when adding a new parent form record; otherwise all of the many many added database join element checkboxes would be shown during the form add. Any suggestions on how to hide an element on a form during the form add mode? Thanks in advance.
 
Put quotes around '{rowid}'

I suspect the problem is that if rowid is blank (new form), the WHERE clause without quotes after we do the substitutions is...

WHERE whatever.fid=

... without a value, which is a syntax error. Add quotes, and it'll be ...

WHERE whatever.fid=''

... which is valid, and won't return anything.

-- hugh
 
Hi Hugh.
Yes, that worked! The error was gone on form additions. Thanks Hugh. Unfortunately, I still have the same issue. If the user now adds a checkbox in the DB Join during a form add then the new checkbox item isn't related to the parent record. So, the only solution I see is to hide the element during a form addition. Any suggestions on how to do so?
Thanks in advance.
 
Hi Hugh.
I was thinking maybe adding JavaScript to the parent ID element with a condition if null (during form add) onload would hide the dbJoin element. If that would work; could I trouble you for an example of the JavaScript that I would use?
Thanks in advance.
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top