I have read it here My link that AJAX validation is not supported on the file upload, but I want to implement very simple thing. In my form I am uploading a file and I want some of the field to be filled automatically with the name of the file and current time stamp and name of user, could any one suggest me how can I achieve that.
How can I achieve this: below are the field from my _form
Alert File: File to be upload
Title: autmatically filled with the file name
Type: User will input
File Name: should fill automatically
Created by: should be filled automatically the logged user name
create on: should be filled by current date
Page 1 of 1
Ajax Form Auto-Fill
#2
Posted 16 January 2013 - 11:23 PM
can you make it clear that
1 - Set them automatically before validation/saving
2 - Set them automatically before submitting form
in first case, you can do as
In case second, you can do using jquery
1 - Set them automatically before validation/saving
2 - Set them automatically before submitting form
in first case, you can do as
$model->user_id=Yii::app()->user->id; $model->time=time();
In case second, you can do using jquery
#3
Posted 17 January 2013 - 01:15 PM
PeRoChAk, on 16 January 2013 - 11:23 PM, said:
can you make it clear that
1 - Set them automatically before validation/saving
2 - Set them automatically before submitting form
in first case, you can do as
In case second, you can do using jquery
1 - Set them automatically before validation/saving
2 - Set them automatically before submitting form
in first case, you can do as
$model->user_id=Yii::app()->user->id; $model->time=time();
In case second, you can do using jquery
I am looking for second option
Thanks
Ashish Tyagi
Ashish Tyagi
#4
Posted 17 January 2013 - 03:34 PM
You then need to have a jquery based settings for this.
for others, you can use as
in controller before saving/validation function call
$('#file_field').on('change',function(){
// define function to get the name of file and store it in some hidden filed for further processing
});
for others, you can use as
in controller before saving/validation function call
$model->user=Yii::app()->user->id; $model->date=time();
#5
Posted 20 January 2013 - 03:36 PM
PeRoChAk, on 17 January 2013 - 03:34 PM, said:
You then need to have a jquery based settings for this.
for others, you can use as
in controller before saving/validation function call
$('#file_field').on('change',function(){
// define function to get the name of file and store it in some hidden filed for further processing
});
for others, you can use as
in controller before saving/validation function call
$model->user=Yii::app()->user->id; $model->date=time();
Thank you very much
Thanks
Ashish Tyagi
Ashish Tyagi
Share this topic:
Page 1 of 1

Help













