floating label in phpmaker - php

I'm trying to create a custom template for my phpmaker project, I tried every possible solution to change the default CSS for labels but I cannot get input: focus selects input when it gets focus and Selector input: not(: focus): valid select input if valid input did not focus. Please suggest some ways to solve this issue
<div id="r_tennam" class="col-sm">
<div class="floating-group">
<label id="elh_tender_tennam" for="x_tennam" class="col-sm col-form-label ew-label"><?php echo $tender_add->tennam->caption() ?><?php echo $tender_add->tennam->Required ? $Language->phrase("FieldRequiredIndicator") : "" ?></label>
<div <?php echo $tender_add->tennam->cellAttributes() ?>>
<span id="el_tender_tennam">
<input type="text" data-table="tender" data-field="x_tennam" name="x_tennam" id="x_tennam" maxlength="200" placeholder=" " value="<?php echo $tender_add->tennam->EditValue ?>"<?php echo $tender_add->tennam->editAttributes() ?>>
</span>
</div>
</div>
</div>

Related

How to deny user input by tying into text field ( input-group ) and allow input from the drop down list (input-group-btn )

We use phpipam.
We have found that if one enters data directly into the subnet field, the built-in CIDR calculations are not honored and an overlapping subnet can be input into the database.
We would like to deny user input, directly to the field while maintaing the architecture of the system and allow user input via the drop down list.
The subnet edit page displayed in html
<?php if (!$showDropMenuFull){ ?>
<input type="text" class="form-control input-sm input-w-200" name="subnet" placeholder="<?php print _('subnet in CIDR'); ?>" value="<?php print #$cidr; ?>" <?php if ($readonly) print "readonly"; ?>>
<?php } else { ?>
<div class="input-group input-w-200">
<input type="text" class="form-control input-sm input-w-200" name="subnet" placeholder="<?php print _('subnet in CIDR'); ?>" value="<?php print #$cidr; ?>">
<?php if (strlen($dropdown_menu)>0) { ?>
<div class="input-group-btn">
<button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Select <span class="caret"></span></button>
<ul class="dropdown-menu dropdown-menu-right dropdown-subnets">
<?php print $dropdown_menu; ?>
</ul>
</div>
<?php } ?>
</div>
<?php } ?>
Try adding the readonly attribute to the input. It should prevent users to edit the input text, but scripts should continue being able to edit, and also it will be submitted in the form.
It will look something like this:
<input type="text" class="form-control input-sm input-w-200" name="subnet" placeholder="<?php print _('subnet in CIDR'); ?>" value="<?php print #$cidr; ?>" readonly="readonly">
You could also use readonly without value, but if you are using XHTML, remember that attribute minification is forbidden, so it must be complete.

Pre tag issue in php

Actually, I have added one textarea in my opencart admin panel I fetch the textarea value to front end but it is not coming properly it coming HTML format, I fixed HTML format also but Pre tag is not working, Lines & showing paragraph only please help me how to resolve this,
admin product_form.tpl
<div class="form-group">
<label class="col-sm-2 control-label" for="input-desc<?php echo $language['language_id']; ?>">
<?php echo $entry_desc; ?>
</label>
<div class="col-sm-10">
<textarea name="product_description[<?php echo $language['language_id']; ?>][short_description]" placeholder="<?php echo $entry_desc; ?>" id="input-short_description<?php echo $language['language_id']; ?>" class="form-control summernote">
<?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['short_description'] : ''; ?>
</textarea>
</div>
</div>
catelog product.tpl
<div class="short_description form-group" itemprop="description">
<h5 itemprop="name">Description:</h5>
<?php
$short_descriptions = strip_tags(html_entity_decode($short_descriptions, ENT_QUOTES, 'UTF-8'));
echo '<pre>';
print_r($short_descriptions);
echo '</pre>';
print_r($short_descriptions);
</div>

Multiple Input AJAX Post

Hi there,
I'm working on a project, but I'm a bit stuck. It's a logical question. I'll explain: We have a list of articles - Table: articles - saved in the database. However, we have collapse-able elements (let's call them accordeons now), which are based on the enabled languages (Table: languages). Now I'm tasked with saving every input for every "Accordeon" in the database, where content for the accordeons is stored in "article_language".
The accordeon
(It's contained in a WHILE-loop)
<div class="accord">
<div class="accordeon-head" data-id="<?php echo $language['shortname']; ?>"><?php echo $language['fullname']; ?><div class="accordeon-right"><i class='fa fa-chevron-down'></i></div></div>
<div class="accordeon-body" data-id="<?php echo $language['shortname']; ?>">
<div class="form-container bottom">
<div class="form-float full-width">
<label class="input-label" for="agg_e_txt"><?php echo $lang['ARTS_INPL_TXT']; ?></label>
<textarea type="text" id="agg_e_txt" name="agg_e_txt"><?php echo $text['article_text']; ?></textarea>
</div>
<div class="clear toplabel"></div>
<div class="form-float middle">
<label class="input-label" for="agg_e_rec"><?php echo $lang['ARTS_INPL_RECUSE']; ?></label>
<textarea type="text" id="agg_e_rec" name="agg_e_rec"><?php echo $text['article_recuse']; ?></textarea>
</div>
<div class="space"></div>
<div class="form-float middle" style="float:right;">
<label class="input-label" for="agg_e_spec"><?php echo $lang['ARTS_INPL_SPEC']; ?></label>
<textarea type="text" id="agg_e_spec" name="agg_e_spec"><?php echo $text['article_spec']; ?></textarea>
</div>
</div>
<div class="clear"></div>
</div>
</div>
I'd like to do this with an AJAX post. What is the best way to store everything for an accordeon in the article_language table with the correct language prefix?
My thoughts were a WHILE loop in the AJAX call, or a each in the jQuery. But, I'm not sure.
What is the best way to achieve this?

highlight whole row div red while error instead of just input field [php codeigniter]

I have a form which is posted via php and if I get a error it highlights only the input field red. What I would like to do or know if there is a way to do is highlight the whole div field which contains the select field and everything and show that this whole div has a error.
Here is my html code.
<div class="form-group">
<div class="<?php if(form_error('fullname')!= null){echo ' has-error';} ?>">
<label class="col-md-4 control-label">
<?php echo lang("full_name"); ?>
</label>
<div class="col-md-8">
<input type="text" name="fullname" class="form-control" value="<?php if (isset($userinfo['Fullname'])) {echo $userinfo['Fullname'];} ?>" placeholder="<?php echo lang(" fullname "); ?>">
</div>
</div>
</div>
Right now it only highlights input field but I want it to highlight the whole div form-group.
Since you are using bootstrap, you could try this. Please change
<div class="form-group">
to
<div class="form-group alert alert-danger">
Try this.
<div class="form-group <?php if(form_error('fullname')!= null){echo ' bg-danger';} ?>">
<div class="<?php if(form_error('fullname')!= null){echo ' has-error';} ?>">
<label class="col-md-4 control-label">
<?php echo lang("full_name"); ?>
</label>
<div class="col-md-8">
<input type="text" name="fullname" class="form-control" value="<?php if (isset($userinfo['Fullname'])) {echo $userinfo['Fullname'];} ?>" placeholder="<?php echo lang(" fullname "); ?>">
</div>
</div>
</div>
What I have done is used, .bg-danger, one of the Bootstrap Contextual Classes based on the same if condition you have to apply the has-error class.

Show variable on frontend based on if checkbox is checked

I hope I can explain this right but the image should make it clear (hopefully).
In the admin side of my site, I have different fields for products, but I do not want the fields shown to the frontend user if the show checkbox isn't checked. As seen in my image below.
Now my issue I am not getting is should I have a row name for every checkbox or can I use just one like show.
simplified can I use something like this
<div class="form-group">
<label class="col-md-3">Sales Price</label>
<div class="col-md-8">
<input type="text" name="price" value="<?php echo $row['price']; ?>" class="form-control" />
</div> <!-- /.col -->
<input type="checkbox" value="1" <?php echo ($row['show'] == 1) ? 'checked="checked"' : ''; ?> name="show">
</div> <!-- /.form-group -->
or do I have to use something like this
<div class="form-group">
<label class="col-md-3">Sales Price</label>
<div class="col-md-8">
<input type="text" name="price" value="<?php echo $row['price']; ?>" class="form-control" />
</div> <!-- /.col -->
<input type="checkbox" value="1" <?php echo ($row['showprice'] == 1) ? 'checked="checked"' : ''; ?> name="showprice">
</div> <!-- /.form-group -->
Here is what I am after using an image.
As for making the content show on the frontend Here is the code for that. This is set up now to NOT show if the data is missing. (I haven't set it up to show about the checkboxes until I figure out what to use)
<?php if (isset($model) && !empty($model)) : ?>
<li class="element element-text">
<strong>Model #: </strong>
<?php echo $model;?>
</li>
<?php endif; ?>
I thought about using something like this, but again I am not sure if I can use a single checkbox (show) for all the variables.
<div style="display:<?= ($offer === 1) ? 'block' : 'none'; ?>"></div>
Again, I hope I explained this good enough and any help would be greatly appreciated.

Categories