BUGFIX: fixed sorting values on new fields

This commit is contained in:
Will Rossiter 2009-04-19 23:52:44 +00:00
parent d4d53acf40
commit b83bc79fc2
4 changed files with 13 additions and 16 deletions

View File

@ -328,8 +328,8 @@ class UserDefinedForm_Controller extends Page_Controller {
$sendCopy = false;
$attachments = array();
$submittedFields = new DataObjectSet();
$submittedFields = new DataObjectSet();
foreach($this->Fields() as $field) {
$submittedField = new SubmittedFormField();
$submittedField->ParentID = $submittedForm->ID;

View File

@ -86,13 +86,9 @@ class EditableTextField extends EditableFormField {
* Populates the default fields.
*/
function DefaultField() {
$disabled = '';
if( $this->readonly ){
$disabled = " disabled=\"disabled\"";
} else {
$disabled = '';
}
if( $this->Rows == 1 ){
$disabled = ($this->readonly) ? " disabled=\"disabled\"" : '';
if($this->Rows == 1){
return '<div class="field text"><label class="left">'._t('EditableTextField.DEFAULTTEXT', 'Default Text').' </label> <input class="defaultText" name="Fields['.Convert::raw2att( $this->ID ).'][Default]" type="text" value="'.Convert::raw2att( $this->getField('Default') ).'"'.$disabled.' /></div>';
}else{
return '<div class="field text"><label class="left">'._t('EditableTextField.DEFAULTTEXT', 'Default Text').' </label> <textarea class="defaultText" name="Fields['.Convert::raw2att( $this->ID ).'][Default]"'.$disabled.'>'.Convert::raw2att( $this->getField('Default') ).'</textarea></div>';

View File

@ -159,12 +159,13 @@ class FieldEditor extends FormField {
$className = "Editable" . ucfirst($_REQUEST['Type']);
$name = $this->name;
if(is_subclass_of($className, "EditableFormField")) {
$e = new $className();
$e->write();
$e->ParentID = $this->form->getRecord()->ID;
$e->Name = $e->class . $e->ID;
$e->write();
return $e->EditSegment();
$field = new $className();
$field->write();
$field->ParentID = $this->form->getRecord()->ID;
$field->Name = $e->class . $e->ID;
$field->Sort = $sort;
$field->write();
return $field->EditSegment();
}
}
return false;

View File

@ -58,5 +58,5 @@
<input type="hidden" class="canDeleteHidden" name="$Name.Attr[CanDelete]" value="$CanDelete" />
<input type="hidden" class="customParameterHidden" name="$Name.Attr[CustomParameter]" value="$CustomParameter" />
<input type="hidden" class="typeHidden" name="$Name.Attr[Type]" value="$ClassName" />
<input type="hidden" class="sortHidden" name="$Name.Attr[Sort]" value="-1" />
<input type="hidden" class="sortHidden" name="$Name.Attr[Sort]" value="$Sort" />
</li>