1 (edited by Alan Hale 15-12-2009 22:24:51)

Re: Errors in tutorial?

I think there may be some errors in the "Build a Data Entry Page" section of the tutorial, specifically in the code:


<?php
echo data_entry_helper::autocomplete(array(
    'label'=>'Species',
    'fieldname'=>'occurrence:taxa_taxon_list_id',
    'table'=>'taxa_taxon_list',
    'captionField'=>'taxon',
    'valueField'=>'id',
    'extraParams'=>$readAuth + array('taxon_list_id' => 'My ID')
));
?>

Shouldn't 'occurrence' be 'occurrences' and 'taxa_taxon_list' be 'taxa_taxon_lists' ?
I'm not entirely sure how this works (and I can't get it working at the moment, even when changing these names) so not sure.

Cheers

Alan

Alan Hale
Aberystwyth

2

Re: Errors in tutorial?

Hi Alan,

No, the references are singular, this is because they are actually references to the model names, not the table names. This perhaps needs to be made more clear in the documents.

Forgive me for asking, but have you replaced My ID in this code snippet with a valid taxon list ID? If you have, then the next step would be to try the system_check method, described here: http://code.google.com/p/indicia/wiki/T … ngProblems. This will pick up any problems in your setup.

Best Wishes

John van Breda
Biodiverse IT

3 (edited by Alan Hale 16-12-2009 09:03:27)

Re: Errors in tutorial?

Hi John

Ah - thought it might be my misunderstanding.
Yes, I have replaced MyID with the the taxon list id  - '2' in this case. (Don't mind you asking :)  )

But, when I view the source of the output page the form section loosk like this:

<form method="post">
<input id="auth_token" name="auth_token" type="hidden" class="hidden" value="2a410efb61791c82c968cce9ac48d0e2eb7d9472" />
<input id="nonce" name="nonce" type="hidden" class="hidden" value="178cea40cb8c75a7d3114b955e9840dc065da627" />
<input type='hidden' id='website_id' name='website_id' value='websiteId' />
<input type='hidden' id='record_status' name='record_status' value='C' />

<label for="occurrence:taxa_taxon_list_id:taxon">Species:</label>
<input type="hidden" class="hidden" id="occurrence:taxa_taxon_list_id" name="occurrence:taxa_taxon_list_id" value="" />
<input id="occurrence:taxa_taxon_list_id:taxon" name="occurrence:taxa_taxon_list_id:taxon" value="" />
<br/>

</form>

i.e. there is no value for "occurrence:taxa_taxon_list_id:taxon".

I tried the system check as you suggested which  gives warnings:

Warning: Missing argument 1 for data_entry_helper::system_check(), called in /var/www/bryos-indicia/testsetup.php on line 3 and defined in /var/www/bryos-indicia/client_helpers/data_entry_helper.php on line 2421
System check

Warning: The following configuration entries are not specified in helper_config.php : $geoplanet_api_key. This means the respective areas of functionality will not be available.

Line 2421 is the start of the system_check function.

Cheers

Alan

Alan Hale
Aberystwyth

4

Re: Errors in tutorial?

Hi Alan
Don't know why I didn't spot the system_check error when I wrote the tutorial - I guess I must have had a different error reporting level in PHP so I didn't see the error at the time. Anyway I've committed a change so this parameter is optional - you can get around it for now by changing the call to data_entry_helper::system_check(true). But I don't think it will tell you any more - only that without a geoplanet_api_key setting the location search functionality won't work, but this is not a problem if you are not using the functionality. 

What are the symptoms of this autocomplete control not working? The code you are outputing looks correct - as the value will only be populated when you select something. One thing that crossed my mind - have you included a call to data_entry_helper::dump_javascript() near the bottom of the page? If not, the JavaScript associated with the autocomplete control cannot be output into the page so the control won't work.

Cheers

John van Breda
Biodiverse IT

5

Re: Errors in tutorial?

Hi John

I'm just seeing an empty input box with it's label.

You had me worried for a minute, but when I checked, yes I do have the call to data_entry_helper::dump_javascript(). Here is the complete page code:

<html>
<head>
<title>Bryos Indicia Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php   require 'client_helpers/data_entry_helper.php'; ?>

</head>

<body>
<form method="post">
<?php
        // Get authorisation tokens to update and read from the Warehouse.
        echo data_entry_helper::get_auth('3', 'mypassword');
        $readAuth = data_entry_helper::get_read_auth('3', 'mypassword');
?>
<input type='hidden' id='website_id' name='website_id' value='websiteId' />
<input type='hidden' id='record_status' name='record_status' value='C' />

<?php
echo data_entry_helper::autocomplete(array(
    'label'=>'Species',
    'fieldname'=>'occurrence:taxa_taxon_list_id',
    'table'=>'taxa_taxon_list',
    'captionField'=>'taxon',
    'valueField'=>'id',
    'extraParams'=>$readAuth + array('taxon_list_id' => '2')
));

?>

</form>
<?php echo data_entry_helper::dump_javascript(); ?>
</body>
</html>

Cheers

Alan

Alan Hale
Aberystwyth

6

Re: Errors in tutorial?

Hi Alan,

So what are the actual symptoms? I've pasted your code into a new page here, changed the website ID, password and checklist ID to something on my database and it works fine so at least there is nothing wrong in your code.

For now I will assume the problem is that the control appears but if you type in something it does not drop down with a list of species name matches? If so, here are a couple of things you can try:
1) If you use FireFox, try the Firebug addin. This lets you see AJAX calls on the Console tab, so you can check the response. E.g. if you have an incorrect website ID or password, you will get {"error":"Unknown Exception: unauthorised"} back, but the control will just appear to not work. In fact Firebug is an excellent tool for client-side web debugging so I'd recommend giving it a try if you haven't already.
2) Have you checked your application\logs folder to see if anything is posted when you try to use the control? As usual when debugging setting your log threshold to 4 in the config.php file will help capture the most information.
3) Try adding the following code to the page which will do a check of various settings and warn you of any problems:

echo data_entry_helper::system_check(true);

Let me know how you get on,

John van Breda
Biodiverse IT

7

Re: Errors in tutorial?

Hi John

Sorry I should have been more specific - yes,  as you suggest: no drop-down list of species when I type in the box.
I'll try out your suggestions.

Many thanks

Alan

Alan Hale
Aberystwyth

8

Re: Errors in tutorial?

... and I've just realised the problem is with the Google Chrome browser I've been using as default. Works fine in IE8 (I'd previously checked this but not after I'd fixed other problems). Firefox I'd removed from my system because of some incompatability problems after I'd moved to Win 7 which I didn't have time to look into. I'll have to try installing again (I have found Firebug very useful in the past).

I'll see if I can establish what the problem is with Chrome.

Sorry to have wasted your time on this.

Cheers

Alan

Alan Hale
Aberystwyth

9

Re: Errors in tutorial?

Hi Alan,

No, its not a waste of time don't worry. The code really ought to work OK in all modern browsers so if it doesn't work in Chrome then it would be good to know why. I normally test in FireFox and IE so maybe I should add Chrome to that list.

It would be good to know what the issue is if you get to the bottom of it.

Best wishes

John van Breda
Biodiverse IT

10 (edited by Alan Hale 16-12-2009 15:00:16)

Re: Errors in tutorial?

OK, debugging the Javascript in Chrome I got this error from the JQuery scripts:

Resource interpreted as script but transferred with MIME type text/plain

and similar for the CSS.

This appears to have been a known issue with Chrome but I checked for an update and installed it and now the drop-down list works fine.

For the record I was on v. 3.0.195.33 of Chrome. Updating to 3.0.195.38 fixed the problem.

Phew!

I gather Chrome still only has 4.4 % share of the browser "market share" but that is expected to rise considerably. I think it has a lot going for it (once you get used to its minimalistic interface). However, it's probably not the best browser for me to try new things out with!

Cheers

Alan

Alan Hale
Aberystwyth