Using checkboxes and radio buttons for report linking

(4 posts) (2 voices)
  1. ajdjackson, Member

    Hi

    I'm currently trying to create a report that allows a user to select options for their new build house.

    I'm looking pointers as to how I can create these selections.

    Some of the selections will be one from many and some will be many from many.

    I would like to present these options in a grid type layout, usually with a small image and price and the user would click either a radio button or click check boxes to select.

    On re-opening this report the user selections should be visible.

    Is this possible and if so please give me some pointers as how I would do this.

    Many thanks

    Jake

  2. myDBR Team, Key Master

    You can use editable fields to collect the data and store the user's choises to the database.

    --
    myDBR Team

  3. ajdjackson, Member

    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

  4. myDBR Team, Key Master

    Jake,
    the problem with the code is that you are getting jQuery object from DOM element mydbr_selected_cell and try to use DOM elements attribute innerHTML which does not exists in the jQuery object (you could just use mydbr_selected_cell.innerHTML.

    If you just want to toggle the image, the better way would be to use CSS class which you toggle.

    Use the browsers debugger to help the JavaScript development.

    --
    myDBR Team


Reply

You must log in to post.