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