form
From SkyPHP
A form file consists of an HTML form and PHP code to populate the HTML form with data from the database. Each AQL model has a form.
Follow These Rules
- Form "name" attribute is the name of the model.
- Form field names must match an alias in the model's aql file. ($field)
- Don't put the save button in the form file. This way you can use the form on a profile page OR in a skybox.
- aql::form() will auto-link the form's css or js file if either exists (see profile page)
Example
/models/person/person_form.php
<? $model = 'person'; $r = aql::profile($model,IDE); ?> <form name="<?=$model?>" class="standard_form"> <? $field = 'fname'; ?> <div id="<?=$field?>" class="field"> <label class="label" for="<?=$field?>">First Name</label> <input type="text" name="<?=$field?>" value="<?=$r[$field]?>" /> </div> <? $field = 'lname'; ?> <div id="<?=$field?>" class="field"> <label class="label" for="<?=$field?>">Last Name</label> <input type="text" name="<?=$field?>" value="<?=$r[$field]?>" /> </div> <? $field = 'bio'; ?> <div class="field"> <textarea id="<?=$field?>" name="<?=$field?>"><?=$r[$field]?></textarea> </div> </form>
/models/person/person_form.css
#bio {
width: 500px;
}
