Posts: 9
Threads: 2
Joined: Jan 2012
Reputation:
0
Feb 15th, 2012, 3:18 AM
Hi again
Is there anyway to make a field that automatically add the currently logged on client name ?
And is there anyway to increase the font size of the text of the form ??
Thanks in advance
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Hi Kokorase,
Quote:Is there anyway to make a field that automatically add the currently logged on client name ?
How would you like this to work, exactly? So when a client account logs in and updates or adds a record, it would store their name?
Quote:And is there anyway to increase the font size of the text of the form ??
You can, but you'd need to edit the CSS for whatever theme you're using: or even develop your own theme to make those changes.
- Ben
Posts: 9
Threads: 2
Joined: Jan 2012
Reputation:
0
Feb 19th, 2012, 1:09 AM
(This post was last modified: Feb 19th, 2012, 1:10 AM by kokorase.)
Hi Ben,
Thanks alot for replying
" How would you like this to work, exactly? So when a client account logs in and updates or adds a record, it would store their name? "
I want this to work when the client adds record .. I'm using the internal form .. so i make it shows the creation date and IP .. i want it to show the name of the client that added this record too .
And for enlarging font .... I'm using the default theme .. but i don't know which CSS file to edit .. can you tell me ..
Thanks alot
Posts: 9
Threads: 2
Joined: Jan 2012
Reputation:
0
Up .. still waiting for answer
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Heya,
Sorry for the wait. Just travelling at the moment, and getting decent (and affordable) internet is surprising tricky.
For the font size, check out this file:
/themes/default/css/general.css - look at line 16 which defines the general styles for many elements, including the font size.
For the other thing, I'll take a look at this today. It'll take some custom code with the Submission Pre-Parser module to do it.
- Ben
Posts: 2,456
Threads: 39
Joined: Dec 2008
Reputation:
6
Hi kokorase,
Here's how to log the name of the client who created the submissions.
1. Install the Hooks Manager module:
http://modules.formtools.org/hooks_manager/
2. In your form, create a new field called something like "Created By"; set it to a textbox, with database size "Medium" (256 chars), and give it database column name "created_by". All this is done on the Edit Form -> Fields tab.
3. Go to the Hooks Manager module and create a new rule with the following info:
Rule Name: "Created By"
Priority: 50
Hook Type: Code Hook
Code Hook: ft_create_blank_submission, end
PHP Code:
PHP Code: global $g_table_prefix;
$name = "{$_SESSION["ft"]["account"]["first_name"]} {$_SESSION["ft"]["account"]["last_name"]}"; $name = ft_sanitize($name);
mysql_query("UPDATE {$g_table_prefix}form_{$form_id} SET created_by = '$name' WHERE submission_id = $new_submission_id");
And that's it! Now, whenever a client (or the admin, for that matter) creates a new submission through the Form Tools interface, it will pull the name of the account (first + last name) and store it in the new "created_by" database column.
To have that information show up in the interface, you'll need to add the field to one of your Views.
Hope this helps!
- Ben
Posts: 9
Threads: 2
Joined: Jan 2012
Reputation:
0
Both solutions have worked out perfectly
Thanks alot for your help Ben .. I won't be able to thank you enough for that .... you are truly a life savior
Posts: 5
Threads: 2
Joined: Feb 2012
Reputation:
0
Nice! This looks like it will accomplish what I was after here:
http://forums.formtools.org/showthread.php?tid=1913
I can use the "created by" field to test against in the Client Map Filters.
I'll report back if that works as expected.
Posts: 7
Threads: 3
Joined: Jan 2012
Reputation:
0
Hi Ben,
This is very usefull, however I would like to ask if it's possible to do the same with field 'company_name' that is located in a different table (account_settings). I tried to create a hook rule for that but doesn't work.
(Feb 24th, 2012, 6:40 PM)Ben Wrote: Hi kokorase,
Here's how to log the name of the client who created the submissions.
1. Install the Hooks Manager module:
http://modules.formtools.org/hooks_manager/
2. In your form, create a new field called something like "Created By"; set it to a textbox, with database size "Medium" (256 chars), and give it database column name "created_by". All this is done on the Edit Form -> Fields tab.
3. Go to the Hooks Manager module and create a new rule with the following info:
Rule Name: "Created By"
Priority: 50
Hook Type: Code Hook
Code Hook: ft_create_blank_submission, end
PHP Code:
PHP Code: global $g_table_prefix;
$name = "{$_SESSION["ft"]["account"]["first_name"]} {$_SESSION["ft"]["account"]["last_name"]}"; $name = ft_sanitize($name);
mysql_query("UPDATE {$g_table_prefix}form_{$form_id} SET created_by = '$name' WHERE submission_id = $new_submission_id");
And that's it! Now, whenever a client (or the admin, for that matter) creates a new submission through the Form Tools interface, it will pull the name of the account (first + last name) and store it in the new "created_by" database column.
To have that information show up in the interface, you'll need to add the field to one of your Views.
Hope this helps!
- Ben
Posts: 17
Threads: 9
Joined: Sep 2012
Reputation:
0
(Feb 24th, 2012, 6:40 PM)Ben Wrote: Hi kokorase,
Here's how to log the name of the client who created the submissions.
1. Install the Hooks Manager module:
http://modules.formtools.org/hooks_manager/
2. In your form, create a new field called something like "Created By"; set it to a textbox, with database size "Medium" (256 chars), and give it database column name "created_by". All this is done on the Edit Form -> Fields tab.
3. Go to the Hooks Manager module and create a new rule with the following info:
Rule Name: "Created By"
Priority: 50
Hook Type: Code Hook
Code Hook: ft_create_blank_submission, end
PHP Code:
PHP Code: global $g_table_prefix;
$name = "{$_SESSION["ft"]["account"]["first_name"]} {$_SESSION["ft"]["account"]["last_name"]}"; $name = ft_sanitize($name);
mysql_query("UPDATE {$g_table_prefix}form_{$form_id} SET created_by = '$name' WHERE submission_id = $new_submission_id");
And that's it! Now, whenever a client (or the admin, for that matter) creates a new submission through the Form Tools interface, it will pull the name of the account (first + last name) and store it in the new "created_by" database column.
To have that information show up in the interface, you'll need to add the field to one of your Views.
Hope this helps!
- Ben
Hi
I have tried this suggestion, and checked my implementation of it, and for me it doesn't work. Please could you suggest where I might be going wrong or how else I could store the username each time a new record gets created.
|