[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4586: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4588: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4589: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
[phpBB Debug] PHP Warning: in file /includes/functions.php on line 4590: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3765)
Xataface Forums • View topic - Simple feedback form isn't simple!
entries, so mucking up the spacing. Have therefore simply commented out the relevant lines in the source code - no issue as no other enum selections envisaged.

c) Have put the following code in my index.php
if ( !$_POST and @$_REQUEST['-limit']){
if ($_REQUEST['-limit'] > 100 ) $_GET['-limit'] = $_REQUEST['-limit'] = 100;
if ($_REQUEST['-limit'] < 10 ) $_GET['-limit'] = $_REQUEST['-limit'] = 25;
}


This fixes the majority of entries (including non numerics), but has some deficiencies and side effects

1) Entering in a single zero doesn't work as you get a display of zero records ('Now showing 1 to 0'), though entering in '00' does work (resetting to 25)! It's as if a single zero is treated as a special case internally. Note that the app errors (as stated before) if a single zero is entered without the above code!?

2) Deleting the show number so it's empty (or spaces) seems to default to 100 rows, though the 'Now Showing' range is displayed as '1 to 0'.

3) If I select another audience, the entered value reverts back to the default row number of 30 (as there is no '-limit=##' entry in the page url. I would like the limit, once over-ridden, to be retained for the whole of the current session (unless the user manually changes it to yet another number). Is this possible, and if so what is the most appropriate method (I think the most likely will be via a new global variable?) and code placement.

Trevor
trevor
 
Posts: 7
Joined: Thu Feb 14, 2008 7:56 am
Location: London
Top

Postby shannah » Tue Feb 19, 2008 1:03 pm

shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby trevor » Wed Feb 20, 2008 4:03 am

trevor
 
Posts: 7
Joined: Thu Feb 14, 2008 7:56 am
Location: London


Return to Library DB Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron

Simple feedback form isn't simple!

A place to discuss and receive support for the Library DB application.

Simple feedback form isn't simple!

Postby trevor » Fri Feb 15, 2008 6:44 am

I am new to Xataface (and especially so to quickforms), and would like to provide the following entry form for all users, whether logged in or not;

a) Text link on welcome page that activates a simple feedback form (prompts are first/last name, email, type of feedback via enum, feedback text) that is integrated into library DB as per the Find form.
b) Entries to be validated and saved to a 'Submissions' table, which also is to have non prompted for admin fields ie 'actioned' (enum y/n) and 'actioneddate' (datetime)
c) The submissions table not to have any visible presence (ie tabs) on the page, and to retain the existing audience menu structure
d) Validation of email entry on submit, with save to database and confirmatory message page to user on successful save plus email to site administrator of new record details.

I have followed the 'How to build submission forms using Xataface' tutorial (ie set up the table, ini files and permissions etc), but don't know how to get it to smoothly integrate into the application without extra tabs and/or loss of the 'audiences' menu on the left of the page.

Some sample snippets of code would be appreciated.

Trevor
trevor
 
Posts: 7
Joined: Thu Feb 14, 2008 7:56 am
Location: London

Postby shannah » Fri Feb 15, 2008 10:26 am

shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby trevor » Fri Feb 15, 2008 1:15 pm

Thanks Steve

Almost there, but still a few issues. I will include all the relevant code below in case you can spot where I'm going wrong (permissions and/or links?) as well as help the others out there with the same predicament.

a) linked to form via
index.php?-table=submissions&-action=new
b) Permissions set as follows (submissions.php);
function getPermissions(&$record){
$app =& Dataface_Application::getInstance();
$query =& $app->getQuery();
if ( $query['-action'] == 'new'){
return Dataface_PermissionsTool::ALL();
} else {
return Dataface_PermissionsTool::NO_ACCESS();
}
}

c) preferences set as follows;
function getPreferences(){
if (!isAdmin()){
return array(
'show_table_tabs'=>0,
'show_record_tabs'=>0,
'show_tables_menu'=>0
);
}
return array();
}


d) Clicked on the link and submissions form displayed, but following issues
i) completely missing the left menu area (is this menu controlled by the -table setting?)
ii) No email address validation type (ie want something like widget:type = email)
iii) If they are already logged in I would like a 'registeredusername'
field to be pre-populated if possible with their current id
iv) Name of table 'submissions' appears in box around form. As I already
have set a title to the page, how do I hide this boxed table name (top left).

e)When I click the submit button I get the following error message after a 'Record successfully saved' message (and I checked the db to cfm the save).
Permission to perform action 'edit' denied. Requires permission 'edit' but only granted '0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0'
This error message was immediately followed by the header text Permission Denied

Relevant settings
actions.ini
[success]
template=success.html
[/success]

success.html
{use_macro file="Dataface_Main_Template.html"}
{fill_slot name="main_column"}

Your Submission was successfull


Thank you for your submission and we will be responding to you shortly.


{/fill_slot}
{/use_macro}

submissions.php
function after_action_new(){
$auth =& Dataface_AuthenticationTool::getInstance();
$user =& $auth->getLoggedInUser();

if ( !$user ){
// The user is not logged in so we forward to a success page.
header('Location: index.php?-action=success');
exit;
}
}

Trevor
trevor
 
Posts: 7
Joined: Thu Feb 14, 2008 7:56 am
Location: London

Postby shannah » Fri Feb 15, 2008 4:21 pm

shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby trevor » Sat Feb 16, 2008 4:24 am

Very many thanks Steve,

Now very very close, but not quite there yet

a) Menu now appears correctly in all tables

b) Email validators
I am developing on a windows environment, so email validation doesn't work as
the 'checkdnsrr' function is not implemented on the Windows platforms. I get
the following warning message (top of page) with an invalid email message by the email prompt;

Warning: preg_match() [function.preg-match]: Empty regular expression in C:\inet\CSAF\dataface\lib\HTML\QuickForm\Rule\Regex.php on line 61

Hopefully when I upload to my online host all will be well.

c) Have added the beforeInsert trigger code
i) This code only inserts data on writing to the database
ii) It does not pre-populate the 'registeredusername' prompt. Basically
I am looking for a mechanism that enables one to set a dynamic
default value on the form. (a beforeDisplay type trigger)

c) To hide the 'submissions' label in the box around the form I adjusted the css by adding 'display: none;' as follows;
legend {
background: White;
padding: 0.5em;
font-size: 90%;
display: none;
}


d) after_action_new trigger
I had already implemented this (see my second posting above). The problem was
that I was a logged in user, so the redirection wasn't being implemented. As
all menu options now appear correctly on all pages (point a above), I just
simply removed the $user check to ensure redirection always occurs to the
success page.

Only point now o/s is a mechanism to preset defaults on the form. As a side
issue to default setting, I do have the following queries with the Find form;

1) If a user does a search (via find), and discovers that the number of records
is vast (my database has over 90000 records and growing), how do I prefill the
the find boxes with their previous search values so that they can easily refine
their criteria. I have stored the find entries in the ENV array variable, so just
need to know how to pre-populate the individual search prompts with these values.

2) One of the prompts is the year of publication. How do I ensure that any entry
is exactly a four digit integer within a specified range (upper limit being the
current year)?

3) Another potential search prompt is a table column which has a choice of two enum
values (say 'A' and 'B'). I would like the search to optionally ignore this, effectively
allowing the user to choose either 'All' (default), 'A' or 'B' and not just 'A' or 'B'.
How does one achieve this, noting the need to reset the default value to its previous setting
if the page is reloaded (a clear all settings button would be a nice feature too, but miracles can wait)?

Just love the depth of functionality available :D

Trevor
trevor
 
Posts: 7
Joined: Thu Feb 14, 2008 7:56 am
Location: London

Postby shannah » Sat Feb 16, 2008 1:48 pm

shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby trevor » Sat Feb 16, 2008 2:40 pm

Steve,

All sounds good, but too late in the evening to do anything further tonight here in London. I also don't think I was clear enough on the resetting of the search criteria to allow user refinement.

Specific example from the online demo;

Click 'Search books', and enter Title='a' and ISBN='0' (zero). The query returns 318 records.

I decide this is too many records to browse through, so immediately click 'Search books' again, hoping to see Title pre-populated with 'a', and ISBN with '0' - but both are blank.

The requirement is therefore to be able to pre-populate all prompt boxes with their previous search settings so enabling the user to easily fine tune the criteria and thus reduce the number of returned records to a manageable size.

One last 'new' query (or is it best to start a new thread when the topic content changes - let me know?) - The Display Records per page box accepts numeric input. I would prefer to only allow users to select the number from a drop down list (say 25, 50, 75 and 100) to ensure that they don't enter a large silly number and time out or crash whilst waiting (motto - protect the users from themselves).

Many thanks for your time and effort to date - much appreciated.

Trevor
trevor
 
Posts: 7
Joined: Thu Feb 14, 2008 7:56 am
Location: London

Postby shannah » Sat Feb 16, 2008 7:07 pm

shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby trevor » Sun Feb 17, 2008 3:37 pm

Steve,

Find now displays previously entered entries correctly (exactly as required - thanks), though the validation on the year doesn't work?

a) year ini file setting (single or double quotes give same result)
validators:regex = "/[0-9]{4}/"
validators:regex:message = "Year must be a four digit number"


I entered in 'abcd' to the year prompt and pressed 'Find' - it doesn't display any error message on the find page but simply shows an empty result list with a 'No records matched your request.' message. Setting regex to 'numeric' (without the quotes) also produces exactly this same result! I expected the find page to be retained with the specified error message displayed against the year prompt!

b) Enums on the 'A', 'B' column
I find the addition of the radio buttons on enum fields very confusing (and so would my potential users). If I select 'None' then regardless of my selection of 'A' or 'B' (or not selecting either), no records are displayed (as all values must be one or the other, no matches would be the expected result anyway). If there were NO radio buttons then the result would be exactly as required (holding the shift key down enables one to select both values, which is the same as OR). Therefore,
i) How do I hide the radio buttons (will look at the css shortly)?
ii) How do I control the depth of the drop down box - it allows for four values, and I only want space for the two characters?

Regarding the limiting of the drop down list box for setting the number of displayed rows, you need to be aware that the entering of certain values can cause the application to crash! If you put in a zero or a non numeric value (ie 'xx')

Found nn of 380 records in table books
Now Showing 1 to 0
(Display 0 Records per page)

Fatal error: Maximum execution time of 30 seconds exceeded in
/home/weblite_ca/lamp/dataface-0.6/Dataface/LinkTool.php on line 89


The script for limiting the user entry therefore needs to be much more robust,
catering (by default) for both a lower limit as well as a non numeric entry!!

Perhaps something like the following (not tested yet, nor efficient - purely to illustrate the respective elements) ;
if ( !$_POST and @$_REQUEST['-limit'] and $_REQUEST['-limit'] > 100 ){
$_GET['-limit'] = $_REQUEST['-limit'] = 100;
elseif ( !$_POST and @$_REQUEST['-limit'] and $_REQUEST['-limit'] < 1 ){
$_GET['-limit'] = $_REQUEST['-limit'] = 25;
elseif ( !$_POST and @$_REQUEST['-limit'] and !ctype_digit($_REQUEST['-limit']) ){
$_GET['-limit'] = $_REQUEST['-limit'] = 25;
}


I have also noticed the following problem areas;

1) potential security error with the demo app (not using the profile feature, so only notifying you of it for informational purposes)
a) Profile page enabled
b) login (guest/guest)
c) Click on My Profile
d) Found states '1 or 3 records in table users', though only one entry in listbox
e) Enter 'a' in the search box, and you can see all three users ('admin', 'guest' and 'admin' again)
f) Click on any of the three users and you can see the details of that user!!
Likely a simple matter to adjust security to prohibit this, but some current installations might not be aware of this out of the box default setting.

2) widget:label text
I added multiple names to the database, and wanted to reference them by their numbers - added in (2) to one label's text, and (3) to the other (and visibility:find=hidden set on both of them). This caused all explicitly hidden fields to be displayed in the list! - had to put the whole label text in single quotes to achieve what was wanted.

Trevor
trevor
 
Posts: 7
Joined: Thu Feb 14, 2008 7:56 am
Location: London

Postby shannah » Sun Feb 17, 2008 9:41 pm

shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby trevor » Mon Feb 18, 2008 5:36 am

Steve,

a) Using a valuelist for year selection is a non starter, as there would be over 100 entries (and the upper limit is governed by the current year value ie currently 2008). Have fudged the issue by setting a warning message on the list page when the year value is non numeric outside of the designated range. It's not pretty (but effectual), so would prefer some validation if possible pre the submission to the list process.

b) By default the AND, OR and NONE settings can't be controlled by css, as hiding them won't hide the associated
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved