[Biojava-dev] Javascript to wordwrap Fasta format

Richard Holland holland at ebi.ac.uk
Sat Dec 8 19:42:43 UTC 2007


You need to implement the 'onkeypress' function. This page has an example:

http://www.w3schools.com/jsref/jsref_onkeypress.asp

What you'd then do is append the key code to the end of the text (unless
Javascript already did it for you before passing the event - I'm not sure
if it does), then read the textarea content into a buffer, process it by
stripping and replacing newlines, then write it back out to the textarea,
like this:

http://www.developer.be/forums/index.cfm/fuseaction/dsp_full_thread/fullthreadid/204/forumID/10.htm

cheers,
Richard

On Sat, December 8, 2007 7:19 am, Mark Schreiber wrote:
> Hi -
>
> I am building a webapp (yes I have gone to the dark side) in JSF which has
> a
> TextArea component that users have to type or paste a Fasta formatted
> sequence for processing.  By default there is no word wrapping, instead
> scroll bars magically appear. What I really want is for the input to wrap
> every 60 characters (even without spaces) unless it is the description
> line
> (first line).
>
> It seems the best way would be to put some javascript in one of the
> 'onXXX'
> events to do it while the user is typing. Does anyone have a snippet that
> might do something like this?
>
> Thanks.
>
> - Mark
> _______________________________________________
> biojava-dev mailing list
> biojava-dev at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biojava-dev
>


-- 
Richard Holland
BioMart (http://www.biomart.org/)
EMBL-EBI
Hinxton, Cambridgeshire CB10 1SD, UK




More information about the biojava-dev mailing list