You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Geoff Hopson <ge...@gmail.com> on 2008/11/25 12:37:44 UTC

Component that reveals extra value

Hi,

I have a screen that requires a fieldset or a field to be able to edit
2 sets of values for the same attribute. If I have a 'name' attribute,
I might want a public facing value to be Fred, but I might want an
internal version to be 'Agent X'. The idea is that, given a suitable
boolean flag (isJamesBond or something) that the 'public' version be
displayed by default, but if the user has the right permission, when
he holds down a certain key combination (eg Ctrl-Shift-A) and mouses
over the field, the 'hidden' value appears/slides into place. If he
holds down Ctrl-Shift-A and clicks on the field, the hidden field
becomes active and he can replace 'Agent X' with 'Agent Y'. When he
finishes with the field (onBlur, tab away etc.) the public version of
the data (Fred) slides back into place.

Any ideas on how to achieve this in Click? Or better, does someone
have something that already does this?

Thanks
Geoff

Re: Component that reveals extra value

Posted by Bob Schellink <sa...@gmail.com>.
Hi Geoff,

I would imagine it to be quite complex to do with HTML. Personally I 
would look at using Click to render the markup, say namefield and 
namefieldalias and ensure the fields have an html ID attribute set so 
one can refer to it easily through Javascript.

Then use one of the Javascript library, Prototype, Mootools, JQuery 
etc to do the fancy stuff such as binding to the events (blur and 
keystroke) as well as sliding the namefieldalias into position and 
hiding it again afterwards.

Creating hotkeys using Javascript is quite difficult because different 
browsers have different built-in shortcuts. So your shortcut 
Ctrl-Shift-A might work in IE but break in Firefox. JQuery has this 
plugin to deal with Hotkeys: http://code.google.com/p/js-hotkeys/. I 
image other libraries should have similar functionality.

Would be interesting to hear what your final solution for this is.

kind regards

bob


Geoff Hopson wrote:
> Hi,
> 
> I have a screen that requires a fieldset or a field to be able to edit
> 2 sets of values for the same attribute. If I have a 'name' attribute,
> I might want a public facing value to be Fred, but I might want an
> internal version to be 'Agent X'. The idea is that, given a suitable
> boolean flag (isJamesBond or something) that the 'public' version be
> displayed by default, but if the user has the right permission, when
> he holds down a certain key combination (eg Ctrl-Shift-A) and mouses
> over the field, the 'hidden' value appears/slides into place. If he
> holds down Ctrl-Shift-A and clicks on the field, the hidden field
> becomes active and he can replace 'Agent X' with 'Agent Y'. When he
> finishes with the field (onBlur, tab away etc.) the public version of
> the data (Fred) slides back into place.
> 
> Any ideas on how to achieve this in Click? Or better, does someone
> have something that already does this?
> 
> Thanks
> Geoff
>