solved Admin Tools Image Upload

nate
@nate
10 years ago
917 posts
In the admin tools section of my module there is an option to create an image. This image is optional. When I try to skip it, I get a validation error. I have it set to required false.

// Avert Image
$_tmp = array(
   'name'     => 'advert_image',
   'label'    => 28,
   'help'     => 29,
   'text'     => 28,
   'type'     => 'image',
   'required' => false
);
jrCore_form_field_create($_tmp);

Quote: {"notices":[{"type":"error","text":"You must upload an image file."}] }


updated by @nate: 04/03/15 02:35:09PM
brian
@brian
10 years ago
10,149 posts
Is this in an actual view function located in your index.php file?


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
nate
@nate
10 years ago
917 posts
Yes sir.
brian
@brian
10 years ago
10,149 posts
Natedogg265:
Yes sir.

We do that pretty much all over the place (audio, video, tickets, etc.) and I am not aware of any issues with it not working right. Try emptying everything in your jr_jrcore_form_session table in case you're viewing an old form session.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
nate
@nate
10 years ago
917 posts
I see this is the form session, form fields column.
Quote: {"name":"advert_image","label":28,"help":29,"text":28,"type":"image","required":0,"module":"jrImage"}
No mention of validate. And I see this for other fields.
Quote: {"name":"advert_title_id","label":30,"help":31,"sublabel":171,"type":"live_search","target":"https:\/\/n8flex.com\/px_msone\/live_titles","validate":false,"form_designer":false,"required":0,"module":"jrCore"},

I've deleted in many times and it just comes back the same way.
updated by @nate: 02/17/15 09:05:45PM
nate
@nate
10 years ago
917 posts
I updated the form and got the form session to show
Quote: {"name":"advert_image","label":28,"help":29,"text":28,"validate":false,"form_designer":false,"required":0,"type":"image","module":"jrImage"}

But I still get the error from the ajax validation.
updated by @nate: 02/17/15 09:16:00PM
michael
@michael
10 years ago
7,791 posts
Just made a quick module to test it out. I used Aparna (jrAparna) to create the moudule, then added in your field to the _create() and _update() fields.

The upload field functioned as expected, it was optional.

I'll attach that module here to see if you get the same reaction with it.
zip
xxUpload.zip  •  21KB


updated by @michael: 02/17/15 11:31:45PM
michael
@michael
10 years ago
7,791 posts
any chance of getting that module and a couple of steps to see the issue failing?
nate
@nate
10 years ago
917 posts
Something is definitely broken. Even if I remove the image from the form completely, I still get the error.
michael
@michael
10 years ago
7,791 posts
try deleting the module, clear out any related stuff in the database. check the settings table and the modules table for anything with your modules prefix, then start again.

Could be that you've removed the input box from the form, but that value has already been saved in the datastore.
nate
@nate
10 years ago
917 posts
This is resolved. Dumped the DB and did a fresh Install.

Tags