Hi
Thanks for getting back especially at the weekend.
I'm ok with editable fields and updating db - where I'm stuck is how I present it to the user.
I've been trying to get a simple case to work - a choice from two options.
I've created a simple report (I've done no styling etc yet) as follows:
select 'dbr.divify';
select 'dbr.colstyle','thumb','image';
select 'dbr.colstyle','status','image';
select 'dbr.hideheader';
select 'dbr.report', 'sp_DBR_SS_JTest','[status]','hiddendiv','event=click';
select left(t.image_name,
length(t.image_name)-4) as "Stove Type[stove]",
t.image_thumb as 'thumb[thumb]',
(case
when (select exists (select 1 from hilmark.tblss_orders where tblss_orders_PlotID=inPlotID and tblss_orders_ChoicesID in (3,4))) = 1 then
(select image_thumb from hilmark.images where image_id = 21)
else (select image_thumb from hilmark.images where image_id = 22)
end) as 'choice1[status]'
from hilmark.images t
where t.image_id = 19;
select 'dbr.divify';
select 'dbr.colstyle','thumb','image';
select 'dbr.colstyle','status','image';
select 'dbr.hideheader';
select 'dbr.report', 'sp_DBR_SS_JTest','[status]','hiddendiv','event=click';
select left(t.image_name,
length(t.image_name)-4) as "Stove Type[stove]",
t.image_thumb as 'thumb[thumb]',
(case
when (select exists (select 1 from hilmark.tblss_orders where tblss_orders_PlotID=inPlotID and tblss_orders_ChoicesID in (3,4))) = 1 then
(select image_thumb from hilmark.images where image_id = 21)
else (select image_thumb from hilmark.images where image_id = 22)
end) as 'choice2[status]'
from hilmark.images t
where t.image_id = 20;
This presents the user with a title, product image, and a field with either a ticked or unticked image in it depending on whether there exists an order for it in the orders table. At the moment there are no orders so both products have an un-ticked image showing.
Hanging of that field I have a report that will eventually do the db updating and change the image to ticked.
The code of this report is as follows:
BEGIN
/*Code for db updating will be here*/
select 'dbr.javascript', "$(mydbr_selected_cell).innerHTML = '';";
END
There is a forward slash before the > in the above to close the img tag but it won't display.
This is as far as I've got. I've no expertise with javascript so I've tried several things suggested by googling.
The above just briefly shows the spinning wheel but doesn't change the image.
If this was working I would then have to display the un-ticked image in either the 'choice1' or chioce2' divs depending on which image was clicked. I've no idea on how to do this.
Any help here would be great.
I also tried using a template but the divs weren't clickable(?) and I couldn't thick of how it would work with set div ids that could be targeted. (Hope you follow that).
The above even if it worked seems clunky to me. If there were more options then there would be a lot of code duplicating.
Is there a better way of doing this?
Cheers and thanks again.
Jake