[eluser]yorvik[/eluser]
Hello
I am using the UI of jquery to style my form. I want a dialogbox to show up where I can select my files.
The dialogbox is showing up perfect and closing (hiding). But when I submit my form the data of the <input file> doesn't work.
this is my jquery code:
Code:
$(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
var name = $( "#name" ),
email = $( "#email" ),
password = $( "#password" ),
allFields = $( [] ).add( name ).add( email ).add( password ),
tips = $( ".validateTips" );
$( "#dialog-form" ).dialog({
autoOpen: false,
height: 750,
width: 750,
modal: true,
buttons: {
"Upload pictures's": function() {
$( this ).dialog( "close" );
},
Cancel: function() {
$( this ).dialog( "close" );
}
},
close: function() {
allFields.hide();
}
});
$( "#create-user" )
.button()
.click(function(e) {
e.preventDefault();
$( "#dialog-form" ).dialog( "open" );
});
});
I use this html
Code:
<?php
$attributes = array('id' => 'myForm');
echo form_open_multipart('art_controller/add_artwork/', $attributes);
echo '<br /><label for="price">Price: </label>' . form_input('price', set_value('price', 'Price'));
echo '<label for="job">Job: </label>' . form_input('job', set_value('job', 'Job'));
?>
<div id="dialog-form" title="Upload foto's">
<p class="validateTips">Selecteer de foto's die u wil uploaden.</p>
<div>
<label for="file[0]"><strong>FotoAlbum</strong></label>
<input type="file" name="test[0]" class="text ui-widget-content ui-corner-all" />
</div>
</div>
</form>
If i don't use the dialog and just show my <input type="file"> on the page everything works fine!
When I submit my form I get the data of price and job correct. But not the data of the file fields. I just hide the dialogbox in my JQuery so I don't get it why the data of my input="file" fields is lost.
Thanks in advance