Tylko żeby ten kod podać, musze wiedzieć, który to jest.
Zostawiam HTML, bo o stworzenie pól formu mi nie chodzi.
Dodawanie ogłoszenia jest gdzies w plikach. Widze dwie lokalizacje:
site_announcements/classes i site_announcements/form. W obu lokalizacjach sa pliki odpowiedzialne chyba za formy dodawania ogłoszeń, tylko w żadnym nie widze kodu html od tych formów.
Może inaczej, wydaje mi się, że to będzie to co ponizej:
Najpierw 3 kroki, które są w:
<div class="box gray">
<h2>
<?php echo __
('Dodaj nowe ogłoszenie') ?></h2>
<div class="content">
<ul class="steps">
<li class="
<?php if($step == 1): ?>active
<?php endif ?>"><span class="number">1</span><span class="text">
<?php echo __
('Wybór kategorii') ?></span></li>
<li class="
<?php if($step == 2): ?>active
<?php endif ?>"><span class="number">2</span><span class="text">
<?php echo __
('Treść ogłoszenia') ?></span></li>
<li class="
<?php if($step == 3): ?>active
<?php endif ?>last"><span class="number">3</span><span class="text">
<?php echo __
('Promocja ogłoszenia') ?></span></li>
</ul>
<div class="clearfix"></div>
</div> <!-- end .box-body -->
</div>
Dalej chyba mamy
<ul class="errors">
<?php if ($form->param('errors')): ?>
<?php foreach ($form->param('errors') as $e): ?>
<li><strong>
<?php echo $e['label'] ?><?php echo (strpos($e['driver_name'], ':') !== FALSE ?
'' : ':') ?></strong>
<?php echo $e['message'] ?></li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
<form action="
<?php echo $form->action() ?>" method="get" class="bform" id="add-announcement-step1" name="
<?php echo $form->param('name') ?>">
<?php echo $form->form_id->render(); ?>
<fieldset class="border">
<p>
<label for="
<?php echo $form->category_parent_id->html('id') ?>">
<?php echo $form->category_parent_id->html('label') ?><span> *</span></label>
<select name="
<?php echo $form->category_parent_id->html('name') ?>" id="
<?php echo $form->category_parent_id->html('id') ?>" class="
<?php echo $form->category_parent_id->html('class') ?>" style="
<?php echo $form->category_parent_id->css() ?>" size="8">
<?php foreach ($form->category_parent_id->html('options') as $value => $name): ?>
<option
<?php if ($form->category_parent_id->data('value') !== NULL AND
$form->category_parent_id->data('value') == $value): ?>selected="selected"
<?php endif ?> value="
<?php echo $value ?>">
<?php echo __
($name) ?></option>
<?php endforeach ?>
</select>
<?php if ($form->category_id->data('has_error')): ?>
<span class="error">
<?php echo $form->category_id->html('error_messages') ?></span>
<?php endif ?>
</p>
<p>
<label for="
<?php echo $form->category_id->html('id') ?>">
<?php echo $form->category_id->html('label') ?><span> *</span></label>
<select name="
<?php echo $form->category_id->html('name') ?>" id="
<?php echo $form->category_id->html('id') ?>" class="
<?php echo $form->category_id->html('class') ?>" style="
<?php echo $form->category_id->css() ?>" size="8">
<?php foreach ($form->category_id->html('options') as $value => $name): ?>
<option
<?php if ($form->category_id->data('value') !== NULL AND
$form->category_id->data('value') == $value): ?>selected="selected"
<?php endif ?> value="
<?php echo $value ?>">
<?php echo __
($name) ?></option>
<?php endforeach ?>
</select>
<?php if ($form->category_id->data('has_error')): ?>
<span class="error">
<?php echo $form->category_id->html('error_messages') ?></span>
<?php endif ?>
</p>
<p>
<label for="
<?php echo $form->annoucement_type->html('id') ?>">
<?php echo $form->annoucement_type->html('label') ?><span> *</span></label>
<select name="
<?php echo $form->annoucement_type->html('name') ?>" id="
<?php echo $form->annoucement_type->html('id') ?>" class="
<?php echo $form->annoucement_type->html('class') ?>" style="
<?php echo $form->annoucement_type->css() ?>" size="8">
<?php foreach ($form->annoucement_type->html('options') as $value => $name): ?>
<option
<?php if ($form->annoucement_type->data('value') !== NULL AND
$form->annoucement_type->data('value') == $value): ?>selected="selected"
<?php endif ?> value="
<?php echo $value ?>">
<?php echo __
($name) ?></option>
<?php endforeach ?>
</select>
<?php if ($form->annoucement_type->data('has_error')): ?>
<span class="error">
<?php echo $form->annoucement_type->html('error_messages') ?></span>
<?php endif ?>
</p>
</fieldset>
<fieldset class="buttons">
<input type="submit" value="
<?php echo __
('Dalej') ?>" />
</fieldset>
</form>
<script type="text/javascript">
$('document').ready(function() {
$('#bform-category-parent-id').bind('change', get_subcategories);
$('#bform-category-parent-id, #bform-category-id, #bform-annoucement-type')
.bind('change', show_hide_submit);
show_hide_submit();
});
function show_hide_submit() {
var fields = $('#bform-category-parent-id, #bform-category-id, #bform-annoucement-type');
var $submit = $('#add-announcement-step1 input[type=submit]').show();
for(var i in fields) {
if(!$(fields[i]).val()) {
$submit.hide();
return;
}
}
}
function get_subcategories() {
var parent_id = $('#bform-category-parent-id').val();
if(parent_id) {
var $category_field = $('#bform-category-id').empty();
$.ajax({
url: base_url + 'ajax/announcements/get_selects/' + parent_id,
dataType: 'json',
success: function(data) {
if (data.length) {
for(var i in data) {
$category_field.append(
'<option value="'+data[i].value+'">'+data[i].name+'</option>'
);
}
}
}
});
}
}
</script>
ale pewien nie jestem.