×
Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
how to add sql-processing to edit-form
Jochen
New Member
Posts: 4
3 năm 1 tháng trước #9903
bởi Jochen
how to add sql-processing to edit-form was created by Jochen
hi,
I've done my first project with Component Creator and I was very surprised of its ease of use. But now I got stuck with one question. My table has a field which needs to be updated by an external file and not with the edit-form. How can I trigger the reading of this file, updateing and running the needed sql ("insert" or "update")? Do I have to create some more "helper" code?
I've done my first project with Component Creator and I was very surprised of its ease of use. But now I got stuck with one question. My table has a field which needs to be updated by an external file and not with the edit-form. How can I trigger the reading of this file, updateing and running the needed sql ("insert" or "update")? Do I have to create some more "helper" code?
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Carl Fuentes
Moderator
Posts: 28
3 năm 1 tháng trước #9905
bởi Carl Fuentes
Replied by Carl Fuentes on topic how to add sql-processing to edit-form
What do you mean by external file? is it a normal text file? or a CSV file?
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Jochen
New Member
Posts: 4
3 năm 1 tháng trước #9907
bởi Jochen
Replied by Jochen on topic how to add sql-processing to edit-form
hi,
no this will be php-code or html-code coming from a file - should go into field "custom_code" - the JCC genned code does not show any method (e.g. in "controllers" or models") to store data with sql update, or insert).
this is my table:
CREATE TABLE IF NOT EXISTS `#__jphpx` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`modified_by` INT(11) NOT NULL DEFAULT 0,
`custom_code` TEXT NOT NULL ,
`title` VARCHAR(1) NOT NULL DEFAULT "1",
`source` VARCHAR(11) NOT NULL DEFAULT "0",
`access` BOOLEAN NOT NULL DEFAULT "0",
`published` BOOLEAN NOT NULL DEFAULT "1",
PRIMARY KEY (`id`)
) DEFAULT COLLATE=utf8mb4_unicode_ci;
no this will be php-code or html-code coming from a file - should go into field "custom_code" - the JCC genned code does not show any method (e.g. in "controllers" or models") to store data with sql update, or insert).
this is my table:
CREATE TABLE IF NOT EXISTS `#__jphpx` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`modified_by` INT(11) NOT NULL DEFAULT 0,
`custom_code` TEXT NOT NULL ,
`title` VARCHAR(1) NOT NULL DEFAULT "1",
`source` VARCHAR(11) NOT NULL DEFAULT "0",
`access` BOOLEAN NOT NULL DEFAULT "0",
`published` BOOLEAN NOT NULL DEFAULT "1",
PRIMARY KEY (`id`)
) DEFAULT COLLATE=utf8mb4_unicode_ci;
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Jochen
New Member
Posts: 4
3 năm 1 tháng trước #9908
bởi Jochen
Replied by Jochen on topic how to add sql-processing to edit-form
hi,
My Application's logic is: 1. get filename from field "source", 2. read content of file and 3. store it into field "custom_code". This works with a standalone php-app - and should now be migrated into a Joomla component.
My Application's logic is: 1. get filename from field "source", 2. read content of file and 3. store it into field "custom_code". This works with a standalone php-app - and should now be migrated into a Joomla component.
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Carl Fuentes
Moderator
Posts: 28
3 năm 1 tháng trước - 3 năm 1 tháng trước #9909
bởi Carl Fuentes
Replied by Carl Fuentes on topic how to add sql-processing to edit-form
This one will need alot of manually coding because Component Creator is not supporting this feature.
I suggest you to add
<field name="filetoread" type="file" label="file to read" description="" hint=""/>
to the xml file of the form.
and use this to ouput the filed output the field to the form
<?php echo $this->form->renderField('filetoread'); ?>
to read that content you will need to edit/overide either the controller or model save() function.
I suggest you to add
<field name="filetoread" type="file" label="file to read" description="" hint=""/>
to the xml file of the form.
and use this to ouput the filed output the field to the form
<?php echo $this->form->renderField('filetoread'); ?>
to read that content you will need to edit/overide either the controller or model save() function.
Last edit: 3 năm 1 tháng trước by Carl Fuentes.
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Jochen
New Member
Posts: 4
3 năm 1 tháng trước #9911
bởi Jochen
Replied by Jochen on topic how to add sql-processing to edit-form
hi,
OK. Will try to use save method on model - but how can I get the data from the edit-form? So I can do the save corrrectly?
OK. Will try to use save method on model - but how can I get the data from the edit-form? So I can do the save corrrectly?
Vui lòng Đăng nhập hoặc Tạo tài khoản để tham gia cuộc hội thoại.
Thời gian tải trang: 0.055 giây