1 (edited by FionaCEDaR 14-03-2012 17:52:00)

Re: Grid ref problem on new form

Hi,
I've just created a new form on a fresh installation of Instant Indicia. The form is based on the General Purpose Data Entry Forms - MNHNL Dynamic 1

I am trying to get the map to move to a location when a grid reference is typed into the spatial reference control but the form just keeps resetting when I do this. I'm pretty sure this worked in a previous installation is experimented with. Have I forgotten a simple setting?

UPDATE: I've just checked on the warehouse and if I select a species and enter a date then enter the grid reference and press enter, the record is submitted. I would have expected the grid reference to be checked on the map to see if it was valid before submitting. I've clearly done something wrong!!

Many thanks,
Fiona

Fiona McCrory
CEDaR Website Officer
www.nmni.com/cedar

2

Re: Grid ref problem on new form

Hi Fiona
If you press return in any form control it will try to submit the form, that's fairly standard web behaviour. Have you tried just tabbing out of the grid ref control? If you do that it should then move the map and show you the grid ref (it does on my own example).
Best wishes

John van Breda
Biodiverse IT

3 (edited by FionaCEDaR 20-03-2012 18:13:08)

Re: Grid ref problem on new form

Thanks John,
I think I got myself a little confused with the form. My colleague has been using it on our test server to check grid references against site names and I think we got crossed wires about the functionality. Clicking Tab does work. Is there any way to add a "find" button beside the grid reference control to allow people to check a grid reference on the map before submitting their record? I have added a bit of text to the label at the moment to explain the need to use the tab key...
Fiona

Fiona McCrory
CEDaR Website Officer
www.nmni.com/cedar

4

Re: Grid ref problem on new form

Hi Fiona
I'm guessing that selecting the grid ref is more or less the last thing you do on your copy of the form, otherwise you would see the grid ref on the map as soon as you moved to the next control? It would of course be possible to add a Find button next to the spatial reference control but it would require you to change the template for this control. If you are interested in looking into this you can find more information at http://code.google.com/p/indicia/wiki/D … mOverrides under the section called "Overridding the HTML templates used by the data_entry_helper class". The template you need to change is called sref_textbox. If you search for the file called helper_base.php in your iform module/client_helpers folder, then open it in a text editor, then search for sref_textbox you will find the default template used to output the HTML for the grid reference input control which will give you a starting point to work from.

I'm not sure if just changing the template will be enough - since clicking the button should in theory trigger the input box to lose focus and therefore the map to show the grid square, but if not you will need to work out how to attach JavaScript to the button which does this. That is a task probably best done by someone with a bit of JavaScript experience (though the above link does give you tips on how to attach custom scripts to the page).

Hope that helps,

John van Breda
Biodiverse IT

5

Re: Grid ref problem on new form

Thanks John
I've rearranged my form as you were right, the map/grid ref was the last thing on the form. Your solution for adding the button sounds a tad to complicated for me at the moment but thanks for the guide. I may become braver at some point!

Cheers,
Fiona

Fiona McCrory
CEDaR Website Officer
www.nmni.com/cedar