HTML5 Options

2009-09-25 Thread Dave

Hi,
I'm attempting to add new options to the Form handler for cakephp
1.2.5.

So far i've been able to edit cake/libs/view/helpers/form.php

Adding

function email($fieldName, $options = array()) {
$options = $this-_initInputField($fieldName, array_merge(
array('type' = 'email'), $options
));
return $this-output(sprintf(
$this-Html-tags['input'],
$options['name'],
$this-_parseAttributes($options, array('name'), null, 
' ')
));
}
function url($fieldName, $options = array()) {
$options = $this-_initInputField($fieldName, array_merge(
array('type' = 'url'), $options
));
return $this-output(sprintf(
$this-Html-tags['input'],
$options['name'],
$this-_parseAttributes($options, array('name'), null, 
' ')
));
}


At line 970 just below the text input box.

I also added
,
'url' = 'text', 'email'
 = 'text'
To the end of the map array on line 608


Finally

case 'email':
case 'url':
To line 776.

I'm curious if this was the correct way or there would be a method to
add this to an extended help handler?
Although after doing this, it does display the url/email input boxes
however it comes with an error.
Notice (8): Array to string conversion [CORE/cake/libs/view/
helper.php, line 330]

Any pointers would be greatly appreciated
Thanks,
Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: HTML5 Options

2009-09-25 Thread Miles J

Well you SHOULD NOT edit the core files. If you want to extend that
form helper, create your own form helper and have it extend the
original.

class MyFormHelper extends FormHelper {
}

Also we dont know what your talking about when you mention line
numbers, because you edited the file and moved the content around to
different lines.

On Sep 25, 6:46 am, Dave nec...@gmail.com wrote:
 Hi,
 I'm attempting to add new options to the Form handler for cakephp
 1.2.5.

 So far i've been able to edit cake/libs/view/helpers/form.php

 Adding

         function email($fieldName, $options = array()) {
                 $options = $this-_initInputField($fieldName, array_merge(
                         array('type' = 'email'), $options
                 ));
                 return $this-output(sprintf(
                         $this-Html-tags['input'],
                         $options['name'],
                         $this-_parseAttributes($options, array('name'), 
 null, ' ')
                 ));
         }
         function url($fieldName, $options = array()) {
                 $options = $this-_initInputField($fieldName, array_merge(
                         array('type' = 'url'), $options
                 ));
                 return $this-output(sprintf(
                         $this-Html-tags['input'],
                         $options['name'],
                         $this-_parseAttributes($options, array('name'), 
 null, ' ')
                 ));
         }

 At line 970 just below the text input box.

 I also added
 ,
                                         'url'     = 'text',  'email'         
 = 'text'
 To the end of the map array on line 608

 Finally

                         case 'email':
                         case 'url':
 To line 776.

 I'm curious if this was the correct way or there would be a method to
 add this to an extended help handler?
 Although after doing this, it does display the url/email input boxes
 however it comes with an error.
 Notice (8): Array to string conversion [CORE/cake/libs/view/
 helper.php, line 330]

 Any pointers would be greatly appreciated
 Thanks,
 Dave
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---