Page 1 of 1

Enter text above a form field

PostPosted: Fri Jan 12, 2018 4:14 pm
by cdmak
Hello,

I'm working towards putting some instructions above some of the fields in the form that will always be visible, is there anyway to do this? Thank You

<span id="el_customers_LAST_NAME">
Here is where the custom text needs to go above the field.
<input data-table="customers" data-field="x_LAST_NAME" data-page="1" name="x_LAST_NAME" id="x_LAST_NAME" size="30" maxlength="150" placeholder="Last Name" value="Smith" class="form-control" type="text">
</span>

Re: Enter text above a form field

PostPosted: Fri Jan 12, 2018 7:10 pm
by kirondedshem
for a more flexible king of setup, use a custom template for your Add/Edit/View page so that you can paste any html anywhere.

for example, for a given table to customise how the fields on the add page are organised, as well as add my html text anywhere I can do this I can paste this in custom templates->add/copy page->custom template. NOTE:replace field names with your actual fields

<div class="row form-group">

<div class="col-lg-4">
Here is where the custom text needs to go above the field.
{{{caption field_1}}}<?php echo $Language->Phrase("FieldRequiredIndicator") ?>
{{{value field_1}}}
</div>
<div class="col-lg-4">
Here is where the custom text needs to go above the field.
{{{caption field_2}}}<?php echo $Language->Phrase("FieldRequiredIndicator") ?>
{{{value field_2}}}
</div>
<div class="col-lg-4">
Here is where the custom text needs to go above the field.
{{{caption field_3}}}<?php echo $Language->Phrase("FieldRequiredIndicator") ?>
{{{value field_3}}}
</div>

</div>

HINT:You basically draw your own HTML and tell it where to render a specific controll, Although I advise you to always use divs as to mantain mobile responsiveness

Re: Enter text above a form field

PostPosted: Sat Jan 13, 2018 3:18 pm
by cdmak
Thank you again,

I found this in the help and trying to get it to work on multipage with no success. What is happening is the label and the fields do not line up evenly like they do when PHPMaker generates the forms. Also when I use CSS to make the fields take up the how width they end up sticking out of the panel. Also the lables don't word wrap like they do when PHPMaker makes them. Where am I going wrong? Thanks.

{{{page_1}}}
<div class="ewRow"><span class="ewCell">{{{FIRST_NAME}}}</span></div>
<div class="ewRow"><span class="ewCell">{{{LAST_NAME}}}</span></div>
<div class="ewRow"><span class="ewCell">{{{EMAIL_ADDRESS}}}</span></div>
{{{/page_1}}}

{{{page_2}}}
<div class="ewRow"><span class="ewCell">{{{MESSAGE}}}</span></div>
{{{/page_2}}}

Also tried this
<div class="ewRow"><span class="ewLabel"></span>{{{FIRST_NAME}}}</span></div>

Re: Enter text above a form field

PostPosted: Sat Jan 13, 2018 10:10 pm
by kirondedshem
inspeact and of the phpmaker generated forms to see how they draw thier divs and take note of the classes they use.
Also NOTE: when drawing responsive divs, people normally use the classes like col-sm-#, col-lg-#, where # represents a number form 1 to 12, one normally uses these to allocate space to be used by content, so you have to tweak it untill you find your right fit, BUT for example

<div class="form-group col-sm-12">
<div class="col-sm-4 control-label ewLabel">
{{{caption field_1}}}<?php echo $Language->Phrase("FieldRequiredIndicator") ?>
</div>
<div class="col-sm-8">
{{{value field_2}}}
</div>
</div>

><div class="ewRow"><span class="ewCell">{{{FIRST_NAME}}}</span></div>
><div class="ewRow"><span class="ewCell">{{{LAST_NAME}}}</span></div>

NOTE:Using {{{field_name}}} = draw both caption and input controll, so for more controll over the layout, I dvise you to draw them separately like ive beenn hinting in my examples, that way you can clearly specify what size the caption or the controll will take up in your divs. Just play with css and bootstarp classes untill you feel its appealing to you.

Re: Enter text above a form field

PostPosted: Sun Jan 14, 2018 12:53 pm
by cdmak
Thank you again kirondedshem for your patience and kind help. I'm a bit new to PHPMaker but am finding out that it is quite possibly the best. I'm able to see how the templates are worked into the project and it is definitely awesome that you can use native bootstrap elements. The helps section makes sense now regarding custom templates.

Thank You

Re: Enter text above a form field

PostPosted: Mon Jan 15, 2018 6:40 pm
by digitalphotoworld
There is a much easier way to add some text. Just use the Page Render event of the site (add/edit) and use

$this->FIELDNAME->CustomMsg .= "<span class='help-block'>This is my additional text</span>";

The code use the bootstrap class help-block. Just replace the FIELDNAME to your needs. It works great with the code that is created by default and you don't have to create your own templates.

Re: Enter text above a form field

PostPosted: Mon Jan 15, 2018 6:49 pm
by kirondedshem
very nice, i dint know about this, I vote for this as well