[EXTENSION] spinner input field

This is my first try so I made something simple

A spinner input form field.

You can try a demo here

and download here

Also I'd appreciate if someone could tell me how to insert highligted color code in the documentation tab of the extension's page

Thanks

Cool thing! I would like to see this added: If you keep clicked on an element, the speed increase of the values passing by.

Quote

Cool thing! I would like to see this added: If you keep clicked on an element, the speed increase of the values passing by.

I intend to add this feature.

I'm not that good with javascript but I'll think i can find a way

I think this should go something like this:

onclick="func"

func ( var a = 1 )

changefield(var a)

var b = a +1

sleep(100)

func(var B)

Iam now quite sure if iam right, but this should be the general “way” hope it helps that you know how to start and what to search ;)

Good idea, this spinner control.

I would appreciate autorepeat with increasing speed every n'th tick until the mouseup event. I've done this in Javascript but need to improve the structure. In this case I guess a good solution would be to let the mousedown handler register element id, up/down direction and other params to the timer callback, make the first call to up/down, finally set off the timer. The mouseup handler will stop the timer. In the timer callback step will be incremented every n'th tick (to increase speed).

Unfortunately the demo doesn't work in IE6/IE7 for the text fields ('Object doesn't support this property or method'). Maybe the 'string' parameter in the call to up()? Numeric fields are OK.

I was unable debug this problem because I get a parse error (unexpected $end … SSpinner.php … on line 313) when including SSpinner in my page.

/Tommy

  • Version 1.1

When the mouse is pressed on the spinner the numbers increase/decrease faster

Fixed a bug with I.E. and string type spinners

Quote

Good idea, this spinner control.

I would appreciate autorepeat with increasing speed every n'th tick until the mouseup event. I've done this in Javascript but need to improve the structure. In this case I guess a good solution would be to let the mousedown handler register element id, up/down direction and other params to the timer callback, make the first call to up/down, finally set off the timer. The mouseup handler will stop the timer. In the timer callback step will be incremented every n'th tick (to increase speed).

Unfortunately the demo doesn't work in IE6/IE7 for the text fields ('Object doesn't support this property or method'). Maybe the 'string' parameter in the call to up()? Numeric fields are OK.

I was unable debug this problem because I get a parse error (unexpected $end … SSpinner.php … on line 313) when including SSpinner in my page.

/Tommy

The problem in IE was an ID conflict of 2 elements. It's fixed now

Alaso as you can see there's a new version where when you keep the mouse button pressed the spinner increases/dicreases faster

Thanks! I'll give it a try.

Probably I get the parse error because I didn't enable "short_open_tag" in php.ini

But, here is a quote from the PHP manual

Quote

Note: Using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on PHP servers which are not under your control, because short tags may not be supported on the target server. For portable, redistributable code, be sure not to use short tags.

Thanks I changed the spinner_1_1.zip  with one with no short tags

I tested the one with short tags. Works great! 8)

The stepping rate is too fast, I think.  My thought was to have an incremental stepping rate, starting with some initial rate and increasing with time elapsed since mousedown.

This will be added as options (speed of spinner and use incremental speed or not ) in the next version

Version 1.2

You can set the delay of the spinner's value update so you can control the speed of the spinner when the mouse is kept pressed on a button (Spinner's delay parameter)

Also when button is kept pressed this speed increases (Spinner's acceleration parameter. Values can be "none", "slow" , "normal" and "fast")

Quote

Version 1.2

You can set the delay of the spinner's value update so you can control the speed of the spinner when the mouse is kept pressed on a button (Spinner's delay parameter)

Also when button is kept pressed this speed increases (Spinner's acceleration parameter. Values can be "none", "slow" , "normal" and "fast")

Great job!

nice work!

how can i use the spinner for time?

i need the time in half hour steps - it is possible?

If you want it in 2 spinners it's easy to set one for the hours and one for the minutes

If you mean something like 00:00, 00:30,1:30,2:00 etc it can't be done but it's a good idea so i'll try to implement it right now and I'll let you know

Quote

nice work!

how can i use the spinner for time?

i need the time in half hour steps - it is possible?

I implemented the STimeSpinner.

I'll upload the update later , when I 'm finished with the documentation

The new version including a Time Spinenr is available

http://www.yiiframework.com/extension/spinner/

Details documentation can be found here:

http://spyros.agilityhoster.com/demos/index.php?r=site/spinnerDoc

Hi,

I get :


Parse error: parse error in C:\wamp\www\protected\extensions\spinner\SNumericSpinner.php on line 211

There is a PHP short tag there…

Something else :

How I can add some $htmlOptions and make the text input manually editable (with keyboard) in the case of Numeric Spinner ?

Same problems for me :slight_smile:

Parse error: parse error in C:\wamp\www\ssis\protected\extensions\spinner\STimeSpinner.php on line 211

[solved by appending <? by <?php ]

Another problem:

In view I would like to use time spinner.

  1. Time spinner does not give neither take proper value from model in view _form:



$this->widget('application.extensions.spinner.STimeSpinner',

array(

"name"=>"Time",

"model"=>$model, //added model and attribute, but still no effect <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/smile.gif' class='bbc_emoticon' alt=':)' />

"attribute"=>"Lenght",

"data"=>array(

"min"=>"06:00",

"max"=>"23:00",

"step"=>15,

"value"=>"12:00"

),

"width"=>60,

"delay"=>100,

"acceleration"=>"slow"

)

);

?>




Thanks for help!

Nice extension thought!

Hi,

I’ll take a look at these problems and I’ll upload a new version soon

Thanks