21278 Posts in 5728 Topics by 2599 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1168 Views |
-
images don't attached from the frontend

8 April 2010 at 6:05pm
It always says "You can add images once you have saved for the first time." but from backed it is ok. all other fields works properly. Please help!
this is for frontend:
function addHotelForm(){
return new Form($this, "addHotelForm",
new FieldSet(
new TextField('Title', 'Ðазвание'),
new TextareaField('Description', 'ОпиÑание'),
new TextField('Location', 'МеÑтоположение'),
new TextField('Adress', 'ÐдреÑ'),
new TextField('Telefone', 'Телефон'),
new NumericField('Price', 'Цены'),
new ImageField('HotelImage', 'Фото ГоÑтиннцы', null, null, null, "assets/Uploads/")
),
new FieldSet(
new FormAction("doSubmitHotel", "добавить новую гоÑтинницу")
),
new RequiredFields(
'Description'
)
);
}function doSubmitHotel($data, $form){
$hotel = new Hotel();
$form->saveInto($hotel);
$hotel->HotelHolderID = $this->dataRecord->ID;
$hotel->write();
$form->sessionMessage(
'ГоÑтинница уÑпешно добавлена!',
'good'
);
Director::redirectBack();
return;
}
and for CMS:
function getCMSFields() {
$fields = parent::getCMSFields();
$HotelTable = new ComplexTableField($this, 'Hotels', 'Hotel');
$fields->addFieldToTab('Root.Content.Hotels', $HotelTable);
return $fields;
}
the "assets/Uploads/" don't work too, images saved to Uploads folder -
Re: images don't attached from the frontend

8 April 2010 at 6:59pm
You should use SimpleImageField for the front end form. The incorrect folder location I think was a bug in 2.3 which should be fixed in 2.4.
| 1168 Views | ||
|
Page:
1
|
Go to Top |


