How to put 2 text box fields side by side

Hi,

How do I make it so that 2 basic text box fields are side by side instead of below (without being in the next row of the edit/detail view).
I have included a screenshot to explain myself better.
The reason I need them side by side is so they feel like a table and items can be read in one long line, I also need them to be 2 separate fields for use with pdf printing.

Its simple. Write custom code in editviewdefs.php file.
In which field you need. There u add.

‘Customcode’ =>’’,

I did not write the html properly . u can write however u want.

Cheers :cheers:

Just go to custom/modules//metadata/editvewdefs.php

Like this,

 1 => 
          array (
            'name' => 'tax_amount',
            'label' => 'LBL_TAX_AMOUNT',
            'customCode' => '<input type=\'text\' name=\'tax_amount\' id=\'tax_amount\' size=\'20\' readonly value=\'{sugar_number_format var=$fields.tax_amount.value}\' maxlength=\'26\' title=\'\' tabindex=\'0\'/>
            <input type=\'text\' name=\'tax_amount_perc\' id=\'tax_amount_perc\' size=\'6\' maxlength=\'26\' value=\'12.36%\' disabled=\'disabled\' >',
          ),

it something look like this,
check in tax portion. as simple as that.

2 Likes

Thanks.
There’s still 2 problems though.
I need the second field to be it’s own field that can be edited and saved to this database, I also need it to available through PDF printing.
How do I achieve this?

hi ajgisme,

I didnot understand the pdf printing concept here. other then,

about field to store into database, for that you have to use before_save logic hook, and their after getting the value you have to store in the database field value.

Thanks, I’ve fixed it in the end. The way I achieved it was by making 2 fields with studio and then using their id’s in the custom code so that it treated the custom boxes as if it were those 2 new fields.

Here is my code for anyone reading:

<textarea name=‘paperworkcopy_artists_c’ id=‘paperworkcopy_artists_c’ rows=“8” cols=“42” value=’’ title=’’ tabindex=‘0’/>{$fields.paperworkcopy_artists_c.value}
<textarea type=‘text’ name=‘paperworkcopy_amounts_c’ id=‘paperworkcopy_amounts_c’ rows=“8” cols=“21” style=“text-align:right;”>{$fields.paperworkcopy_amounts_c.value}