Re: Form width fieldset and different button types

2015-05-19 Thread Rob M
In CakePHP 2.x, FormHelper::inputs doesn't make buttons. It makes input 
elements. If you want a button, try using FormHelper::submit for a submit 
button, or in this case FormHelper::button as in:

echo $this-Form-button('Cancel upload', 
array('type' = 'reset',
  'class' = 'btn btn-warning cancel')
);

 
HTH!

On Monday, May 18, 2015 at 1:48:35 PM UTC-4, Sam Clauw wrote:

 Hi there!

 I'm trying to use the jquery file uploader 
 https://github.com/blueimp/jQuery-File-Upload/wiki in combination with 
 CakePHP.

 The HTML form uses 3 different button types:

- submit (button type=submitStart upload/submit)
- reset (button type=resetStart upload/submit)
- button (button type=buttonStart upload/submit)

 With CakePHP, I try to create those buttons via $this-Form-inputs, but I 
 don't find out how I should sum up those different type of inputs.

 I tried the following, but it ends up that those buttons are becoming 
 input fields instead:

 echo $this-Form-create('OutletPhoto', array(
 'type' = 'file',
 'novalidate' = true, // browser validatie
 'inputDefaults' = array(
 'label' = true,
 'div' = 'form-group',
 'class' = 'form-control'
 ),
 'role' = 'form'
 ));

 echo $this-Form-inputs(array(
 'legend' = false,
 'name' = array(
 'type' = 'file',
 'multiple',
 'label' = false,
 'id' = 'file_upload',
 'name' = 'file_upload',
 'class' = false,
 'before' = 'Pick photos',
 'after' = ''
 ),
 'Start upload' = array(
 'type' = 'submit',
 'label' = false,
 'class' = 'btn btn-primary start'
 ),
 'Cancel upload' = array(
 'type' = 'reset',
 'label' = false,
 'class' = 'btn btn-warning cancel'
 ),
 'Delete' = array(
 'type' = 'button',
 'label' = false,
 'class' = 'btn btn-danger delete'
 )
 ));

 echo $this-Form-end('Save');

 Here's the HTML output of this code:

 div class=form-groupdiv class=submit*input class=btn 
 btn-primary start type=submit value=Start upload*/div/div
 div class=form-group*input name=data[OutletPhoto][Cancel upload] 
 class=btn btn-warning cancel type=reset id=OutletPhotoAnnuleerUpload*
 /div
 div class=form-groupbutton class=btn btn-danger delete 
 type=submitDelete/button/div

 Anyone who can tell me why my Start upload and Cancel upload don't show up 
 as a button? Thanks in advance! ;)


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Form width fieldset and different button types

2015-05-19 Thread Sam Clauw
FormHelper::inputs does create more than only input elements. I have forms 
where I've included textareas and selects in it.
So I hoped we could also put some submit and reset buttons in it ;)

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.