The following warnings occurred:
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 783 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined variable $newpmmsg - Line: 40 - File: global.php(841) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/global.php(841) : eval()'d code 40 errorHandler->error
/global.php 841 eval
/printthread.php 16 require_once
Warning [2] Undefined array key "style" - Line: 909 - File: global.php PHP 8.1.31 (Linux)
File Line Function
/global.php 909 errorHandler->error
/printthread.php 16 require_once
Warning [2] Undefined property: MyLanguage::$lang_select_default - Line: 5024 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 5024 errorHandler->error
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key "additionalgroups" - Line: 7162 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 7162 errorHandler->error
/inc/functions.php 5044 is_member
/global.php 909 build_theme_select
/printthread.php 16 require_once
Warning [2] Undefined array key 1 - Line: 1415 - File: inc/functions.php PHP 8.1.31 (Linux)
File Line Function
/inc/functions.php 1415 errorHandler->error
/inc/functions.php 1370 fetch_forum_permissions
/printthread.php 76 forum_permissions
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error
Warning [2] Undefined array key "showimages" - Line: 160 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 160 errorHandler->error
Warning [2] Undefined array key "showvideos" - Line: 165 - File: printthread.php PHP 8.1.31 (Linux)
File Line Function
/printthread.php 165 errorHandler->error



Form Tools
Couple of queries? - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5)
+--- Thread: Couple of queries? (/showthread.php?tid=137)



Couple of queries? - brad - May 4th, 2009

Hey all,

Great script, really impressed and so much potential.

Got a couple of can yous with it though.

1. Can you have a hidden field on the form that automatically populates with the username who is filling in the form?

2. Using above apply a filter so that the user can only see submissions for them?

3. Part of our form also asks for a Town/City, and we will have certain people in that town that will need to see those results, but only for their town, can we do that as well?

Cheers

Brad


RE: Couple of queries? - Ben - May 6th, 2009

Hey Brad,

Quote:1. Can you have a hidden field on the form that automatically populates with the username who is filling in the form?

Yes, but you'll need to use the Submission Pre-Parser module. This module lets you add custom PHP code to process the incoming info and - pretty much - do whatever the heck you want with it. So in this case, you'd add a rule that just did this:

PHP Code:
$_POST["my_hidden_field"] = $_POST["username"]; 

It's pretty much that simple.

Quote:2. Using above apply a filter so that the user can only see submissions for them?

Yes... but I'd like to hear a few more details to confirm we're on the same page, first. If I understand you write, you'd have multiple users (or "clients" in FT terminology). They'd each have a client account set up. They'd be the ones filling in the forms (correct?) [in which case, you'd need to tweak the above example I gave for #1 to pull the account info from sessions - but the principle is the same].

Quote:3. Part of our form also asks for a Town/City, and we will have certain people in that town that will need to see those results, but only for their town, can we do that as well?

Yes (he says tentatively), but again I'd need a few more details. You can set up client accounts to view whatever subset of the information that you want. So you could, for example, set up a View that only shows submissions for a particular user and for a particular town/country. This is no problem - but note that it's NOT dynamic (i.e. you can't create these data subsets on the fly), you'd need to create each account manually that would view the appropriate data.

Man, that sounded clearer in my head. Let me know if I can make it sound any more confusing. Wink

- Ben


RE: Couple of queries? - brad - May 6th, 2009

Ben

You pretty much got what I am trying to do, and with a bit of research yesterday I think I am on the right track, our form is a 3 page form, and on one form are two fields that use autocomplete with a wizzy java script. The easiest way I found to get the two working was to split the form, and have a confirm button for the first field that actually submits the form and loads a second looking the same. I then used the @fields strings to pre-populate the info again so to the user it does not look like another page.

I will add a hidden field to the form that grabs their username/id and then use that in the filtering for that user?

For the town filtering do the same?

Really exited now, things are looking good, and really love how flexible this is, nice work!


RE: Couple of queries? - brad - May 8th, 2009

Ben have tried what you said about using the pre-parser and nothing is being added, any further advice?


RE: Couple of queries? - brad - May 8th, 2009

Managed to get it to pass the username by using this

$username = $_SESSION['ft']['account']['username'];

on the form, then using the echo to put the value in the hidden field.


RE: Couple of queries? - brad - May 8th, 2009

Only trouble I am having now if anyone has any suggestions? The above works on the form to pass back the username in a field, and it appears in the results in admin view.

What I want to do is add a view filter for the users so that it compares that value with their username and only returns matching results.

Any ideas? Have tried putting the session string in the value of the filter, but that returned nothing.


RE: Couple of queries? - Ben - May 9th, 2009

Hey Brad,

Sorry for the long wait. Darn day job!

Quote:What I want to do is add a view filter for the users so that it compares that value with their username and only returns matching results.

Hmm... this is trickier... This was actually what I was warning about when I said it wasn't "dynamic". There's currently no way to feed in values from the logged in user to the View feature. Each user has to be manually hardcoded.

But you're not the first person to request this feature so let me give it some thought. If I haven't written back in the next few days send an angry email to formtools@encorewebstudios.com. Smile It may well be impossible for the time being, but I need a little time to think it all through.

- Ben


RE: Couple of queries? - Ben - May 9th, 2009

Heya,

Actually, I just spent some time looking over the code and can give a definitive "no" to this particular feature for the moment.

What needs to be done is expand the dropdowns on the View filters page to include a new section for users - not just the form fields. Anything other would be a terrible hack. And unfortunately this is no small change...

Sorry I couldn't help on this feature just yet.

- Ben


RE: Couple of queries? - brad - May 9th, 2009

Ben I am not saying I am a wiz at coding, far from it, but pick things up fast, before 2 weeks ago never created pages with java or mysql queries, and done both with ajax, and works really well.

Perhaps I could create a custom page and add it to the users drop down and then hack the template to remove the view option? At least thats what I was thinking as a back up.