I am using the same view page for both submitting data to database and editing. When I submit the form all the elements go to database. When editing the input field contains the item to edit but the dropdown form doesnot load and displays error saying $expensetype not defined. the $expensetype is passed through the controller to the form. I am developing in pyrocms. Pyrocms is developed in Codeigniter.
<li>
<label for="expense_type_id">Expense Type</label> <!-- expense_type_id-->
<div class="input">
<?php echo form_dropdown("expense_type_id",$expensetype, set_value("expense_type_id", $expense_type_id)); ?>
</div>
</li><li>
<label for="expense_rs">Expense(NRS)</label> <!-- expense_rs-->
<div class="input">
<?php echo form_input("expense_rs", set_value("expense_rs", $expense_rs)); ?>
</div>
</li>
How to make the dropdown to show the item while editing.
Related
I have a variable numbr forms I want a user to be able to choose to view via a drop down list. I have assigned each of the form content to array $forms & the associated form name to array $formnames
The idea was to display the variable number of form names as buttons in the drop down selection, and once selected it would display the form content.
I've tried the below code but this leads to the drop down selection immediately showing both the form content as well as name. Could someone point me in the right direction given my limited understanding?
<div class="dropdown">
<button onclick="dropdownfunction()" class="dropbtn">Available List</button>
<div id="avaiablelist" class="dropdown-content">
<?php
$keys = array_keys($forms);
$namekeys = array_keys($formnames);
$arraysize = count($forms);
for($i=0; $i<$arraysize;$i++) { ?>
<?php echo $formnames[$i]['formname']; ?>
<?php
}
?>
</div>
</div>
In this case i would use
<form action=<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?> method="post">
</form>
to send $forms[$i]['form'] via Post method
I have a form in a Joomla component in which the user needs to select a country and then a city depending on the country selected. In my case I only need one country. How can I edit or replace the code below to set the country to a default value and remove it from the form?
<div class="form-group">
<label for="submit-location"><?php echo JText::_('COM_BT_PROPERTY_LOCATION');?></label>
<?php echo $this->form->getInput('country'); ?>
</div>
<div class="form-group">
<?php echo $this->form->getInput('city'); ?>
</div>
Thank you for your time. Any suggestion is much appreciated!
I am making a simple page and I have found this little problem. I have this in my template:
<?php foreach ($this->vypis_serie as $value) : ?>
<div class="serie">
<div id="serie_header">
<?= $value['nazev_cviceni'] ?>
</div>
<div id="serie_info">
<p>Number of excercises: TODO</p>
<p>Sport type: <?= $value['typ'] ?></p>
<p>KCal summary: <?= $value['kcal'] ?></p>
</div>
<div class="button_upravit">Edit</div>
<div class="button_smazat">Delete</div>
</div>
<?php endforeach; ?>
basically it is a block that fills in information about particular exercise (it is a sport app). SO If I have 3 entries in DB, it will print this code three times with corresponding info.
The problem I have is with the edit button, which upon clicking opens modal window. It is made purely with CSS, so no Javascript.
When I click the button, it jumps to this code:
<div id="openModal_edit" class="modalDialog">
<div>
X
<div id="editace">
<form id="platba" action="serie/edit/" method="post" enctype="multipart/form-data">
<fieldset>
<legend>Edit serie</legend>
<ol>
<li>
<label for="name">Name of the series</label>
<input id="name" name="nazev_cviceni" type="text" required autofocus>
</li>
<li>
<label for="typ">Sport type</label>
<select name="typ">
<option value="Kolo">Bike</option>
<option value="Běhání" selected="selected">Running</option>
</select>
</li>
</ol>
</fieldset>
<fieldset>
<button type="submit">Save</button>
</fieldset>
</form>
</div>
</div>
</div>
But since I jump to div id and I am not using a new page where I could choose a controller and pass a variable, I need somehow to pass the variable (id of the exercise) to the modal window, so I can know which of the possible buttons I have clicked. Is there any way to do it, without the need to rewrite all other pages where I have used this modal window?
I can't use another foreach like in the first part, because the modal window is always a single object that appears, unlike all the entries on the page that are there as many times as there are entries in the DB.
Hope that it is understandable, sorry for my English :)
The simplest way to do this using a single modal window involves adding some javascript code to your page.
First, add the relevant information to the edit link, with a new data-serie-<name> for each piece of data you want to pass:
<a href="#openModal_edit" data-serie-name="<?= $value['nazev_cviceni'] ?>" ...>
Next, add an onclick event handler to that same link. This handler will extract the embedded data from the <a> element and inject it in the modal window. The dataset element provides access to the data-* attributes from javascript
// Example
onclick="serieName=this.dataset.serieName;document.querySelector('#openModal_edit input#name').value = serieName;return true;"
I have a PHP form that is split into 3 separate PHP pages. The first page submits the form info which is then processed by a third party API. The returned (validated) results are then presented in the second PHP page along with a form for further processing.
My question is whether or not there is a way I can integrate this process into the BootStrap Wizard Plugin with its tab structure.
e.g. Fill and submit form by clicking on 'next' and have the Wizard plugin move to tab 2. showing the the next PHP page which has been processed.
<!-- Wizard -->
<section class="wizard">
<!-- Wizard navigation -->
<ul>
<li>Registration</li>
<li>Next step</li>
<li>Confirmation</li>
</ul>
<!-- Wizard progress bar -->
<div class="progress progress-line progress-striped">
<div class="progress-bar progress-bar-success"></div>
</div>
<!-- Wizard content -->
<div class="tab-content">
<div class="tab-pane" id="step1">
<h3>This is first step</h3>
<form method="post" action="myform.php?api=form&step=1">
<input type="text" name="phonenumber" id="phonenumber" />
<input type="submit" value="continue" class="btn btn-primary" />
</form>
</div>
<div class="tab-pane" id="step2">
<h3>Second step content</h3>
<form method="post" action="myform.php?api=form&step=2">
<input type="text" name="faxnumber" id="faxnumber" />
<input type="submit" value="continue" class="btn btn-primary" />
</div>
<div class="tab-pane" id="step3">
<h3>This is third final step (completed)</h3>
<p>Form Process Complete</p>
</div>
<!-- Wizard pager -->
<ul class="wizard pager">
<li class="previous">Previous</li>
<li class="next">Next</li>
<li class="next finish">Finish</li>
</ul>
</div>
</section>
<!-- /Wizard -->
<script src="/js/jquery.bootstrap.wizard.js"></script>
<script>
$(document).ready(function() {
$('.wizard').bootstrapWizard({onTabShow: function(tab, navigation, index) {
var wizard = $('.wizard');
var $total = navigation.find('li').length;
var $current = index+1;
var $percent = ($current/$total) * 100;
wizard.find('.progress-bar').css({width:$percent+'%'});
// If it's the last tab then hide the next button and show the finish instead
if($current >= $total && $total != 0) {
wizard.find('.pager .next').hide();
wizard.find('.pager .finish').show().removeClass('disabled');
} else {
wizard.find('.pager .next').show();
wizard.find('.pager .finish').hide();
}
}});
});
</script>
So what I'm trying to achieve is for the first form to show it's results in the second tab of the wizard.
Yes you can, I would suggest using the bwizard.js and bwizard.css plugin. And add a button to a form, now u going to have to call the action using ajax and not using an actual input of type submit. Using jQuery, on success of "btn_submit" you will taget the 2nd tab to focus to by giving each tab an I'd, or u can use page inspector and target the default I'd of each tab, which if I remember correctly used to be #step1 etc.
i need to add a field into component com_categories, this is for i need add new values in categories, for example these are the archives that i modified:
Joomla 3.1.5
administrator\components\com_categories\views\category\tmp\
<div class="control-group">
<div class="control-label">
<?php echo $this->form->getLabel('subtitulo'); ?>
</div>
<div class="controls">
<?php echo $this->form->getInput('subtitulo'); ?>
</div>
</div>
and too in this file:
administrator\components\com_categories\models\forms\category.xml
<field
name="subtitulo"
type="textarea"
label="subtitulo"
description="USE ESTE SUBTITULO"
rows ="4" cols="6" filter="raw"
/>
So, the new field appear in backend administrator but when i save the new data incustom field... disapear!
The problem would be save the new field into Database or another method, because when i modify the template (default_items.php) can i se the changes i do, the new field if is saved must be appear using
<?php
print_r($this);
?>
but dont appear the new data (subtitulo), whats wrong??, how can i do to add new field in mod_categories and access it.