Welcome Guest, Not a member yet? Register   Sign In
Re-populating the form + Form Helper
#1

[eluser]Renato Tavares[/eluser]
It is possible to use the ability to repopulate my forms even if I am using the Form Helper? Let me explain:

This is a basic form I have:

Code:
<?php echo validation_errors(); ?>
            <?php echo form_open('pages/contact/submit', array('id' => 'contact-form')); ?>
            <fieldset>
                <div class="control-group">
                    <div class="controls">
                        &lt;?php echo form_input(array('class' => 'input-block-level', 'name' => 'contact_name', 'id' => 'contact_name', 'placeholder' => 'Digite seu nome')); ?&gt;
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        &lt;?php echo form_input(array('class' => 'input-block-level', 'name' => 'contact_email', 'id' => 'contact_email', 'placeholder' => 'Digite seu email')); ?&gt;
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        &lt;?php echo form_dropdown('contact_department', array('Dúvida' => 'Dúvida', 'Pagamento' => 'Pagamento', 'Sugestão' => 'Sugestão', 'Crítica' => 'Crítica', 'Publicidade' => 'Publicidade', 'Elogio' => 'Elogio'), 'Elogio', 'id="contact_department" class="input-block-level"'); ?&gt;
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        &lt;?php echo form_textarea(array('class' => 'input-block-level', 'name' => 'contact_message', 'id' => 'contact_message', 'placeholder' => 'Digite sua mensagem', 'rows' => '5')); ?&gt;
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        <label class="checkbox">
                            Entendo que o Localizze não é afiliado aos Correios e não pode resolver problemas sobre minha encomenda. &lt;?php echo form_checkbox(array('name' => 'contact_agree', 'id' => 'contact_agree', 'value' => 1, 'checked' => FALSE, 'style' => 'margin-top:-7px;')); ?&gt;
                        </label>
                    </div>
                </div>
                <div class="form-actions">
                    &lt;?php echo form_button(array('id' => 'contact-form-submit', 'type' => 'submit', 'class' => 'btn btn-primary btn-large', 'content' => 'Enviar', 'data-loading-text' => 'Enviando...')); ?&gt;
                    &lt;?php echo form_button(array('type' => 'reset', 'class' => 'btn btn-large', 'content' => 'Cancelar')); ?&gt;
                </div>
            </fieldset>
            &lt;?php echo form_close(); ?&gt;


I would use the

Code:
&lt;input type = "text" name = "username" value = "&lt;? php echo set_value ('username');?&gt;" size = "50" /&gt;

but how to do this in array?
#2

[eluser]CroNiX[/eluser]
The same way you are doing the others
Code:
$username = array(
  'name'  => 'username',
  'id'      => 'username',
  'class'  => 'some-class',
  'size'   => 50,
  'value'  => set_value('username')
);

Code:
echo form_input($username);
#3

[eluser]Renato Tavares[/eluser]
Thanks, it was really my ignorance.

NetBeans had error whenever I tried to do that, but it was really a lack of finish writing everything.

Another thing I missed was using echo inside the array

¬ ¬




Theme © iAndrew 2016 - Forum software by © MyBB