Template files from demo

(8 posts) (2 voices)

Tags:

  1. eugfri, Member

    hi,

    for some reason my installation of mydbr does not contain templates demo and hence I don't have template file(s) as a sample. Where can I get them? At least that simple invoice form you have in demo on the site.

    Thank you

  2. eugfri, Member

    Sorry, never mind. Let me clarify. I am using template but I am trying to make editable fields part of the template.

    Something like this:

    <form>
    <table width="95%">
    <tr>
    <td width="50%">First Name: <input type="text" name="FirstName" value="{#FirstName}" size="25"></td>
    <td>Last Name: <input type="text" name="LastName" value="{#LastName}" size="25"></td>
    </tr>
    <tr>
    <td width="50%">Email: <input type="text" name="Email" value="{#Email}" size="30"></td>
    <td >Chat: <input type="text" name="Chat" value="{#Chat}" size="20"></td>
    </tr>
    <tr>
    <td colspan="2" align="center">Company: <input type="text" name="CompanyName" value="{#CompanyName}" size="80"></td>
    </tr>
    <tr>
    <td colspan="2"> </td>
    </tr>
    </table>
    </form>

    Report code is also very simple:

    SELECT 'dbr.template', '#Quote';
    SELECT 'dbr.editable', '[CompanyName]', 'sp_DBR_ReviewQuote_edit_customer', 'inLogin=[inLogin]','inCompanyName=CompanyName';
    SELECT 'dbr.editable', '[FirstName]', 'sp_DBR_ReviewQuote_edit_firstname', 'inLogin=[inLogin]','inFirstName=FirstName';
    SELECT 'dbr.editable', '[LastName]', 'sp_DBR_ReviewQuote_edit_lastname', 'inLogin=[inLogin]','inLastName=LastName';
    SELECT 'dbr.editable', '[Email]', 'sp_DBR_ReviewQuote_edit_email', 'inLogin=[inLogin]','inEmail=Email';
    SELECT 'dbr.editable', '[Chat]', 'sp_DBR_ReviewQuote_edit_chat', 'inLogin=[inLogin]','inChat=Chat';
    SELECT CompanyName, FirstName, LastName, Email, Chat FROM ssn.QuoteStaging WHERE SalesRep = inLogin LIMIT 1;

    It does not work, i.e. values in input fields are not being picked up, so I am wondering
    1) is it even possible to have editable fields in template
    2) if it is - what am I doing wrong in the code above?

    Thank you!

  3. myDBR Team, Key Master

    The templates in demo are in documentation. See Commands / Templates.

    You can have editable fields in templates. What you need to to is to use template variables which contain the editable field. See documentation for more info.

    --
    myDBR Team
    .

  4. eugfri, Member

    I have been reading thru this
    http://mydbr.com/doc/content/cmd.templates.html

    So in resultsets for each dbr.record I can make some columns editable using the usual dbr.editable?
    Is that correct?

  5. myDBR Team, Key Master

    Yes,
    with dbr.record you simply store the content to template variable. The content can be any normal myDBR code (including editable content).

    --
    myDBR Team

  6. eugfri, Member

    ok, very good. I am able to have editable fields inside of the template using template variables. Its all good and working, thank you!
    However, there is one small issue. If the column from the resultset has no value and I am showing it as editable column - it is practically invisible. I tried to play with styles to make clearly visible input box with borders using css, but no luck.

    If its just one field with no value in the row of columns with data - it is not a problem, but if within the template I show one field and nothing else next to it and field has no value, there is just no way to see it for the user, there is no clearly visible input box, textare etc. I have tried jeditable options for height and width, but still - no effect if field has no value.

    Would you have any suggestions?

  7. myDBR Team, Key Master

    You are free to style the editable area however you like. You can set height, width, border background etc using normal dbr.colstyle, dbr.colclass commands.

    If you make sure you have the latest build, you can also use a div as editable field:

    select 'dbr.editable', 'comm', 'sp_DBR_edit_comment', 'inID=id', 'options={width:115,height:16}';
    
    select 'dbr.divify';
    select 'dbr.hidecolumn', 'ID';
    select 'dbr.colstyle', 'com', '[width:120px;height:22px;line-height: 22px;border:1px solid #AAA]'; select id as 'ID', comment as 'Comment[comm]'
    from data
    where id=1;

    --
    myDBR Team

  8. eugfri, Member

    oh, got it.
    Thank you very much for all your help!


Reply

You must log in to post.