Enter text above a form field

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.

Enter text above a form field

Postby cdmak » Fri Jan 12, 2018 4:14 pm

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>
cdmak
 
Posts: 24
Joined: Tue Nov 22, 2016 10:51 am

Re: Enter text above a form field

Postby kirondedshem » Fri Jan 12, 2018 7:10 pm

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
kirondedshem
 
Posts: 330
Joined: Sat Jan 28, 2017 7:13 pm

Re: Enter text above a form field

Postby cdmak » Sat Jan 13, 2018 3:18 pm

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>
cdmak
 
Posts: 24
Joined: Tue Nov 22, 2016 10:51 am

Re: Enter text above a form field

Postby kirondedshem » Sat Jan 13, 2018 10:10 pm

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.
kirondedshem
 
Posts: 330
Joined: Sat Jan 28, 2017 7:13 pm

Re: Enter text above a form field

Postby cdmak » Sun Jan 14, 2018 12:53 pm

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
cdmak
 
Posts: 24
Joined: Tue Nov 22, 2016 10:51 am

Re: Enter text above a form field

Postby digitalphotoworld » Mon Jan 15, 2018 6:40 pm

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.
digitalphotoworld
 
Posts: 386
Joined: Wed Jan 09, 2013 12:26 am

Re: Enter text above a form field

Postby kirondedshem » Mon Jan 15, 2018 6:49 pm

very nice, i dint know about this, I vote for this as well
kirondedshem
 
Posts: 330
Joined: Sat Jan 28, 2017 7:13 pm


Return to General Discussion (PHPMaker)