Search Results

Search found 799 results on 32 pages for 'textfield'.

Page 5/32 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to save links with tags and parameters in TextField

    - by xRobot
    I have this simple Post model: class Post(models.Model): title = models.CharField(_('title'), max_length=60, blank=True, null=True) body = models.TextField(_('body')) blog = models.ForeignKey(Blog, related_name="posts") user = models.ForeignKey(User) I want that when I insert in the form the links, then these links are saved in the body from this form: http://www.example.com or www.example.com to this form ( with tag and rel="nofollow" parameter ): <a href="http://www.example.com" rel="nofollow">www.example.com</a> How can I do this ? Thanks ^_^

    Read the article

  • AS3 XML Slideshow Woes

    - by Chris
    Hello All, I am hoping someone out there can possibly shed some light on a couple issues I am having with an image slideshow I have been working on a simple slideshow for a project and everything was going great/as expected up until I created a function to hide the previous images before displaying the next. On the first pass through everything seems to run fine; once the slideshow starts over, the images don't show up, yet when it goes to load the following image, it plays the tween from the hide previous function which shows the image briefly before fading out. So essentially the display is blank, then the timer calls in the next slide and its a brief flash of an image fading out, and then blank again. Another issue I am having is the text that I am loading in from the XML does not seem to want to tween in or out as they are supposed to. Here is the code: import fl.transitions.Tween; import fl.transitions.easing.*; import fl.transitions.TweenEvent; import flash.display.BitmapData; import flash.display.Bitmap; import flash.display.Sprite; import flash.utils.Timer; import flash.events.TimerEvent; var filePath:String = "photo1.xml"; var iArray:Array = new Array(); var titleArray:Array = new Array(); var dateArray:Array = new Array(); var catArray:Array = new Array(); var descArray:Array = new Array(); var rotationSpeed:Number; var totalImages:Number; var dataList:XMLList; var imagesLoaded:Number = 0; var currImage:Number = 0; var rotationTimer:Timer; var oldTween:Tween; var imageContainer:Sprite = new Sprite(); var imageHolder:Sprite = new Sprite(); var titleContainer:Sprite = new Sprite(); var dateContainer:Sprite = new Sprite(); var catContainer:Sprite = new Sprite(); var descContainer:Sprite = new Sprite(); var theMask:Sprite = new Sprite(); theMask.graphics.beginFill(0x000000); theMask.graphics.drawRect(114, 25, 323, 332); addChild(theMask); var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE, onComplete); loader.load(new URLRequest(filePath)); function onComplete (evt:Event):void{ var pigData:XML = new XML(evt.target.data); pigData.ignoreWhitespace; dataList = pigData.pic; totalImages = dataList.length(); rotationSpeed = pigData.@speed * 1000; stage.scaleMode = StageScaleMode.NO_SCALE; loadImages(); rotationTimer = new Timer(rotationSpeed); rotationTimer.addEventListener(TimerEvent.TIMER, rotateImage); rotationTimer.start(); } function loadImages() { for (var i:Number = 0; i < totalImages; i++) { var imageURL:String = dataList[i].big; var imageLoader:Loader = new Loader(); imageLoader.load(new URLRequest(imageURL)); imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded); iArray.push(imageLoader); var titleField:TextField = new TextField(); var dateField:TextField = new TextField(); var catField:TextField = new TextField(); var descField:TextField = new TextField(); titleField.text = dataList[i].title; titleField.autoSize = TextFieldAutoSize.LEFT; titleArray.push(titleField); dateField.text = dataList[i].date; dateField.autoSize = TextFieldAutoSize.LEFT; dateArray.push(dateField); catField.text = dataList[i].category; catField.autoSize = TextFieldAutoSize.LEFT; catArray.push(catField); descField.text = dataList[i].description; descField.autoSize = TextFieldAutoSize.LEFT; descArray.push(descField); } } function imageLoaded(evt:Event):void { imagesLoaded++; if (imagesLoaded == totalImages) { showImage(); } } function showImage():void { addChild(imageContainer); imageContainer.addChild(imageHolder); imageContainer.addChild(titleContainer); imageContainer.addChild(dateContainer); imageContainer.addChild(catContainer); imageContainer.addChild(descContainer); changeImage(); } function changeImage():void { var currentImage:Loader = Loader(iArray[currImage]); imageHolder.addChild(currentImage); currentImage.x = (stage.stageWidth - currentImage.width)/2; currentImage.y = (imageHolder.height - currentImage.height)/2; imageHolder.mask = theMask; new Tween(imageHolder, "alpha", Regular.easeOut, 0, 1, 1, true); var titleField:TextField = TextField(titleArray[currImage]); titleContainer.addChild(titleField); titleField.x = 107; titleField.y = 365; var titleTween:Tween = new Tween(titleField, "alpha", Regular.easeOut, 0, 1, 1, true); var dateField:TextField = TextField(dateArray[currImage]); dateContainer.addChild(dateField); dateField.x = 107; dateField.y = 375; var dateTween:Tween = new Tween(dateField, "alpha", Regular.easeOut, 0, 1, 1, true); var catField:TextField = TextField(catArray[currImage]); catContainer.addChild(catField); catField.x = 107; catField.y = 385; var catTween:Tween = new Tween(catField, "alpha", Regular.easeOut, 0, 1, 1, true); var descField:TextField = TextField(descArray[currImage]); descContainer.addChild(descField); descField.x = 107; descField.y = 395; var descTween:Tween = new Tween(descField, "alpha", Regular.easeOut, 0, 1, 1, true); } function rotateImage(evt:TimerEvent) { hidePrev(); currImage++; if (currImage == totalImages) { currImage = 0; } changeImage(); } function hidePrev():void{ var oldImage:Loader = Loader(imageHolder.getChildAt(0)); oldTween = new Tween(oldImage,"alpha", Regular.easeOut, 1, 0, 1, true); oldTween.addEventListener(TweenEvent.MOTION_FINISH, onFadeOut) var oldTitle:TextField = TextField(titleContainer.getChildAt(0)); var oldTitleTween:Tween = new Tween(oldTitle,"alpha", Regular.easeOut, 1, 0, 1, true); var oldDate:TextField = TextField(dateContainer.getChildAt(0)); var oldDateTween:Tween = new Tween(oldDate,"alpha",Regular.easeOut,1,0,1,true); var oldCat:TextField = TextField(catContainer.getChildAt(0)); var oldCatTween:Tween = new Tween(oldCat,"alpha",Regular.easeOut,1,0,1,true); var oldDesc:TextField = TextField(descContainer.getChildAt(0)); var oldDescTween:Tween = new Tween(oldDesc,"alpha",Regular.easeOut,1,0,1,true); } function onFadeOut(evt:TweenEvent):void{ imageHolder.removeChildAt(0); titleContainer.removeChildAt(0); dateContainer.removeChildAt(0); catContainer.removeChildAt(0); descContainer.removeChildAt(0); } I'm no flash whiz, bet can generally figure most issues out by either analyzing the code, or digging around online; however, this has me stumped. Any help would really be appreciated, and I thank you all in advance.

    Read the article

  • Get user-inputed file name from JFileChooser Save dialog box

    - by Anya
    This answer to this question may seem obvious, but I'm actually struggling with it quite a bit. I've searched through JFileChooser methods in the API, and I've looked at some of the questions already asked and answered here on stackoverflow. My question is this. In my program, I am to allow the user to type in a file name which I will then use to create a brand new file that I will write on. How do you get the text the user has entered in the textfield next to the label "Save As:" on the Save dialog box provided by JFileChooser? Is there a JFileChooser method that would allow me to get that user-inputed text? Or would I have to go through another class, or do something else to get that text? Thank you so much, to anyone who answers. It's very late for me now, and this program is due in a few hours (meaning I'll be having another sleepless night). Desperate may be too strong a word, but I'm something close enough.

    Read the article

  • [AS3] htmlText not showing bold or italics font

    - by Conor
    So I have a MovieClip asset with a dynamic textfield sitting inside of it. I export my .fla as a .swc to use within Flash Builder 4, and create instances of the asset with code, populating the text dynamically from XML. My issue is that even though I have htmlText enabled, bold and italics tags don't appear to be working. I have a feeling it is because when I created the asset in Flash CS4, the text field makes you specify the font, and the subset of that to use (Regular, Bold, Oblique, etc). Is there any way to get the htmlText to render bold and italics tags properly without having to completely rethink the way I'm creating all these fields?

    Read the article

  • regex in textfield

    - by klox
    dear all..i have this code: <script> var str="KD-R435MUN2D"; var matches=str.match(/(EE|[EJU]).*(D)/i); if (matches) { var firstletter = matches [1]; var secondletter = matches [2]; var thirdletter = matches [3]; alert(firstletter + secondletter + thirdletter); }else{ alert (":("); } </script> i want it can control a textfield <input type="text" id="mod">..how must i do?

    Read the article

  • Android: i need password example

    - by user1475122
    I have long been looking for a functioning example of a password, but I have not found. can someone help me? Explained more clearly: I have a TextField named password and I want that when it is written in 123 and press the button it goes to another activity if it is written in 123 if not it would inform the "wrong password!" and that the password is found file, which is / sdcard / Android / password.txt if you understood :) SORRY FOR MY BAD ENGLISH! I'm Finnish, and a young coder :) ( I hope someone may be understood :D )

    Read the article

  • SSRS 2005 Keep textbox and textfield together when page break occurs

    - by EKet
    Problem I don't have a details row or anything. I have simply a body and I dragged on textboxes for labeling textfields from my dataset. The problem is when one of the fields has too much data for the current page, it "page-breaks" at the start of the field leaving the textbox (label for the field) behind on the previous page. What I've tried Put the data field and the textbox label a) inside a rectangle - didn't work b) inside a list and the list inside a rectangle - didn't work c) inside a list with keep together property set to TRUE or FALSE - didn't work Question How would I group the textbox and the textfield so that regardless of where the pagebreak happens it includes its label?

    Read the article

  • Regex doesn't work properly

    - by oneofthelions
    I am trying to implement a regular expression to allow only one or two digits after a hyphen '-' and it doesn't work properly. It allows as many digits as user types after '-' Please suggest my ExtJS Ext.apply(Ext.form.VTypes, { hyphenText: "Number and hyphen", hyphenMask: /[\d\-]/, hyphenRe: /^\d+-\d{1,2}$/, hyphen: function(v){ return Ext.form.VTypes.hyphenRe.test(v); } }); //Input Field for Issue no var <portlet:namespace/>issueNoField = new Ext.form.TextField({ fieldLabel: 'Issue No', width: 120, valueField:'IssNo', vtype: 'hyphen' }); This works only to the limit that it allows digits and -. But it also has to allow only 1 to 2 digits after - at most. Is something wrong in my regex? hyphenRe: /^\d+-\d{1,2}$/,

    Read the article

  • how do i get textfield value then combine with regex

    - by klox
    i have this code for get data from textfield: <script type="text/javascript"> var mod=document.getElementById("mod").value; ajax(mod); function callback() { if(ajaxObj(mod) { document.getElementById("divResult").innerHTML=ajaxObj.responseText; }); }; </script> and this one for search character: <script> var str="KD-R435MUN2D"; var matches=str.match(/([EJU]).*(D)/i); if (matches) { var firstletter = matches [1]; var secondletter = matches [2]; var thirdletter = matches [3]; alert(firstletter + secondletter + thirdletter); }else{ alert (":("); } </script> how to combine both?please help...

    Read the article

  • Rails - Help scoring an online quiz in RoR

    - by ChrisWesAllen
    I'm trying to grade a quiz application I would like to make. I have a questions model with and ask(the actual question), 4 choices(a-d), and a correct answer(string). In the view I have the 4 question being diplayed then the correct answer choice (This is just a test for functionality) and then I created a text_field to accept the users answer choice and a button to refresh the index action which has the scoring logic, for now.. --Do I need to put the text_field within a form_tag? <p>1. <%= h @question.q1 %></p> <p>2. <%= h @question.q2 %></p> <p>3. <%= h @question.q3 %></p> <p>4. <%= h @question.q4 %></p> <p>Answer: <%= h @question.correct %></p> <%= text_field_tag :choice, params[:choice] %> <%= button_to "Grade", {:controller => 'site', :action => "index"} %> <p> <%= @answer %></p> Heres the index controller action def index @question = Question.find(1) if @question.correct == params[:choice] @answer = 'right' else @answer = 'wrong' end end Its not really working. The textfield is supposed to take a letter choice like 'a' or 'c' and compare it with the correct answer in the database. I would love this to work by radiobuttons, but I'm a newbie to rails so I thought I'd take baby steps. So if anyone can help me with how to fix this by string, or preferably by radiobuttons, I'd really appreciate it.

    Read the article

  • UIPickerview filter list from a user previous textfield input

    - by user1547180
    int variabla; - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 1; } - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { if (variabla == 1) return list4.count; else if(variabla == 2) return list3.count; if (variabla == 3) return list1.count; if (variabla == 4) return list2.count; return YES; [pickerView reloadAllComponents]; } - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { if (variabla == 1) { subjectField.text = [list4 objectAtIndex:row]; } else if (variabla == 2) { gradeField.text = [list3 objectAtIndex:row]; } else if (variabla == 3) { mathField.text = [list1 objectAtIndex:[pickerView selectedRowInComponent:0]]; selectedRow = [pickerView selectedRowInComponent:0]; coreTView.text = [mathMeaning objectAtIndex:selectedRow]; } if (variabla == 4) { elaField.text = [list2 objectAtIndex:[pickerView selectedRowInComponent:0]]; selectedRow = [pickerView selectedRowInComponent:0]; coreTView.text = [elaMeaning objectAtIndex:selectedRow]; } [pickerView reloadAllComponents]; NSLog(@"row selected is %d", selectedRow); } - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { if (variabla == 1) return [list4 objectAtIndex:row]; if (variabla == 2) return [list3 objectAtIndex:row]; if (variabla == 3) return [list1 objectAtIndex:row]; if (variabla == 4) return [list2 objectAtIndex:row]; return NO; [pickerView reloadAllComponents]; } Hey I would like to know or pointed in the right direction on how to load a UIPickerView based on the user input from a previous uitextfield so if they type in the previous textfield apple I would like red, green, blue to show in the UIPickerView or if they type orange I would like to see orange, yellow grape thanks for the help in advance.

    Read the article

  • How I can get output from 1st frame textfield input text to 2nd frame textArea

    - by soulgreen
    Here is my 1st frame - I want went I input text in textfield example name then click button report will display output to 2nd frame using textArea... please help me import java.awt.; import java.awt.event.; import javax.swing.; import javax.swing.border.; public class Order extends JFrame implements ActionListener { private JPanel pInfo,pN, pIC, pDate,Blank,pBlank, button, pTotal; private JLabel nameL,icL,DateL; private JTextField nameTF, icTF; private JFormattedTextField DateTF; private JButton calB,clearB,exitB,reportB; public Order() { Container contentPane = getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.setBackground(Color.gray); pInfo = new JPanel(); pN = new JPanel(); pIC = new JPanel(); pDate = new JPanel(); nameTF = new JTextField(30); icTF = new JTextField(30); DateTF = new JFormattedTextField(java.util.Calendar.getInstance().getTime()); DateTF.setEditable (false); DateTF.addActionListener(this); nameL = new JLabel(" NAME : ",SwingConstants.RIGHT); icL = new JLabel(" IC : ",SwingConstants.RIGHT); DateL = new JLabel(" DATE :",SwingConstants.RIGHT); pInfo.setLayout(new GridLayout(10,2,5,5)); pInfo.setBorder(BorderFactory.createTitledBorder (BorderFactory.createEtchedBorder(),"ORDER")); pN.add(nameL); pN.add(nameTF); pIC.add(icL); pIC.add(icTF); pDate.add(DateL); pDate.add(DateTF); pInfo.add(pN); pInfo.add(pIC); pInfo.add(pDate); pInfo.setBackground(Color.GRAY); pN.setBackground(Color.gray); pIC.setBackground(Color.gray); pDate.setBackground(Color.gray); nameL.setForeground(Color.black); icL.setForeground(Color.black); DateL.setForeground(Color.black); nameTF.setBackground(Color.pink); icTF.setBackground(Color.pink); DateTF.setBackground(Color.pink); contentPane.add(pInfo,BorderLayout.CENTER); Blank = new JPanel(); pBlank = new JPanel(); button = new JPanel(); calB = new JButton("CALCULATE"); calB.setToolTipText("Click to calculate"); clearB = new JButton("RESET"); clearB.setToolTipText("Click to clear"); reportB = new JButton ("REPORT"); reportB.setToolTipText ("Click to print"); exitB = new JButton("EXIT"); exitB.setToolTipText("Click to exit"); Blank.setLayout(new GridLayout(2,2)); Blank.setBorder(BorderFactory.createTitledBorder (BorderFactory.createEtchedBorder(),"")); button.setLayout(new GridLayout(1,4)); button.add(calB,BorderLayout.WEST); button.add(clearB,BorderLayout.CENTER); button.add(reportB,BorderLayout.CENTER); button.add(exitB,BorderLayout.EAST); Blank.add(pBlank); Blank.add(button); contentPane.add(Blank,BorderLayout.SOUTH); Blank.setBackground(Color.gray); pBlank.setBackground(Color.gray); calB.setForeground(Color.black); clearB.setForeground(Color.black); reportB.setForeground(Color.black); exitB.setForeground(Color.black); calB.setBackground(Color.pink); clearB.setBackground(Color.pink); reportB.setBackground(Color.pink); exitB.setBackground(Color.pink); calB.addActionListener(this); clearB.addActionListener(this); reportB.addActionListener(this); exitB.addActionListener(this); } public void actionPerformed(ActionEvent p) { if (p.getSource() == calB) { } else if (p.getSource() == clearB) { } else if (p.getSource () == reportB) { } else if (p.getSource() == exitB) { } } public static void main (String [] args) { Order frame = new Order(); frame.setTitle("Order"); frame.setSize(500,500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.setVisible(true); frame.setLocationRelativeTo(null);//center the frame } }

    Read the article

  • Django automatically compress Model Field on save() and decompress when field is accessed

    - by Brian M. Hunt
    Given a Django model likeso: from django.db import models class MyModel(models.Model): textfield = models.TextField() How can one automatically compress textfield (e.g. with zlib) on save() and decompress it when the property textfield is accessed (i.e. not on load), with a workflow like this: m = MyModel() textfield = "Hello, world, how are you?" m.save() # compress textfield on save m.textfield # no decompression id = m.id() m = MyModel.get(pk=id) # textfield still compressed m.textfield # textfield decompressed I'd be inclined to think that you would overload MyModel.save, but I don't know the pattern for in-place modification of the element when saving. I also don't know the best way in Django to decompress when the field when it's accessed (overload __getattr__?). Or would a better way to do this be to have a custom field type? I'm certain I've seen an example of almost exactly this, but alas I've not been able to find it recently. Thank you for reading – and for any input you may be able to provide.

    Read the article

  • How can I use a conditional TextField in JasperReports?

    - by Jonas
    I would like to have a TextField depenging on a value. When the value is "0" I would like to hide the TextField. I.e. I would like to hide the staticText and the textField if the parameter red is equal to "0" in the jrxml-code below: <staticText> <reportElement x="100" y="30" width="100" height="30"/> <text><![CDATA[Red items:]]></text> </staticText> <textField> <reportElement x="200" y="30" width="40" height="30"/> <textFieldExpression> <![CDATA[$P{red}]]> </textFieldExpression> </textField> How can I do this?

    Read the article

  • iPad popover textfield - resignFirstResponder doesn't dismiss keyboard

    - by mosdev
    I have two text fields email and password. The following code works fine when the fields are presented on a regular view but when they are on a popover, the resignFirstResponder does not work (becomeFirstResponder works). textFieldsShouldReturn was called for both fields. Any idea if I am missing something? Thanks! - (BOOL)textFieldShouldReturn:(UITextField *)theTextField { if (theTextField == email) { [password becomeFirstResponder]; return NO; } [theTextField resignFirstResponder]; return NO; }

    Read the article

  • Type attribute for text_field

    - by Koning Baard XIV
    I have this code: <%= f.text_field :email, :type => "email", :placeholder => "[email protected]" %> So people can enter their email on an iPhone with the email keyboard instead of the ASCII keyboard. However, the output is: <input id="user_email" name="user[email]" placeholder="[email protected]" size="30" type="text" /> which should be: <input id="user_email" name="user[email]" placeholder="[email protected]" size="30" type="email" /> Is there a way to force Rails to use the email type instead of text, or must I use HTML directly? Thanks

    Read the article

  • Link in input text field

    - by Jos
    HI All, I know this is bit strange question, but please suggest. I want to create a link on website url content in input type"text" field not any other html tag,Is it possible and if yes how. Regards & Thanks Amit

    Read the article

  • TextField focus on UIAlertView

    - by Nyxem
    Hello, I have a subclass of UIAlertView with 2 UITextField for login / password. My problem is that when I have finished to type my login and change the focus to the password field, there is a cursor on the login field and on the password field, but the focus is on the password field, so my question is, how can I make the cursor disappear on the login field ? Thanks for your help.

    Read the article

  • Calculation Conundrum - how do I influence another textfield?

    - by LawVS
    Hey! Basically I have a problem in that when certain parameters are used in my calculator app - it makes the result incorrect. The issue is that I have separate text fields for hours and minutes and say for example I have as the start time "13" in one text field and "30" in the other with the finish time "24" and "00" in their respective text fields. The answer should be 10 hours 30 minutes, but the answer I get is 11 hours 30 minutes. The code for this is the following. -(IBAction)done:(id)sender { int result = [finishHours.text intValue] - [startHours.text intValue]; totalHours.text = [NSString stringWithFormat:@"%d", result]; if (result < 0) { totalHours.text = [NSString stringWithFormat:@"%d", result + 24]; } -(IBAction)done2:(id)sender { int result = [startMinutes.text intValue] - [finishMinutes.text intValue]; totalMinutes.text = [NSString stringWithFormat:@"%d", result]; if (result < 0) { totalMinutes.text = [NSString stringWithFormat:@"%d", result + 60]; } } I want to make it so if certain parameters are met, then the totalHours.text is reduced by 1 hour to reflect the total minutes. How would I go about that calculation in code? Thanks!

    Read the article

  • iphone - Regex for date in user entered textfield

    - by vikinara
    Hi all, Am a newbie to iphone programming. i have a input box and the user can write his DOB(mm/dd/yyyy) into the box. Before i save the data i like to test for valid input. I am using Regexlite.h and Regexlite.m.i have the regular expression too. i want to compare the regex to the user entered value in text box.But am not knowing how to do it.Please help. Any idea how to test for a valid date? (in .NET i use a simple regex but for the iPhone sdk i am a bit helpless) - but somebody must have been done this before... Thanks Viki

    Read the article

  • Selecting and inserting text at cursor location in textfield with JS/jQuery

    - by IceCreamYou
    Hello. I have developed a system in PHP which processes #hashtags like on Twitter. Now I'm trying to build a system that will suggest tags as I type. When a user starts writing a tag, a drop-down list should appear beneath the textarea with other tags that begin with the same string. Right now, I have it working where if a user types the hash key (#) the list will show up with the most popular #hashtags. When a tag is clicked, it is inserted at the end of the text in the textarea. I need the tag to be inserted at the cursor location instead. Here's my code; it operates on a textarea with class "facebook_status_text" and a div with class "fbssts_floating_suggestions" that contains an unordered list of links. (Also note that the syntax [#my tag] is used to handle tags with spaces.) maxlength = 140; var dest = $('.facebook_status_text:first'); var fbssts_box = $('.fbssts_floating_suggestions'); var fbssts_box_orig = fbssts_box.html(); dest.keyup(function(fbss_key) { if (fbss_key.which == 51) { fbssts_box.html(fbssts_box_orig); $('.fbssts_floating_suggestions .fbssts_suggestions a').click(function() { var tag = $(this).html(); //This part is not well-optimized. if (tag.match(/W/)) { tag = '[#'+ tag +']'; } else { tag = '#'+ tag; } var orig = dest.val(); orig = orig.substring(0, orig.length - 1); var last = orig.substring(orig.length - 1); if (last == '[') { orig = orig.substring(0, orig.length - 1); } //End of particularly poorly optimized code. dest.val(orig + tag); fbssts_box.hide(); dest.focus(); return false; }); fbssts_box.show(); fbssts_box.css('left', dest.offset().left); fbssts_box.css('top', dest.offset().top + dest.outerHeight() + 1); } else if (fbss_key.which != 16) { fbssts_box.hide(); } }); dest.blur(function() { var t = setTimeout(function() { fbssts_box.hide(); }, 250); }); When the user types, I also need get the 100 characters in the textarea before the cursor, and pass it (presumably via POST) to /fbssts/load/tags. The PHP back-end will process this, figure out what tags to suggest, and print the relevant HTML. Then I need to load that HTML into the .fbssts_floating_suggestions div at the cursor location. Ideally, I'd like to be able to do this: var newSuggestions = load('/fbssts/load/tags', {text: dest.getTextBeforeCursor()}); fbssts_box.html(fbssts_box_orig); $('.fbssts_floating_suggestions .fbssts_suggestions a').click(function() { var tag = $(this).html(); if (tag.match(/W/)) { tag = tag +']'; } dest.insertAtCursor(tag); fbssts_box.hide(); dest.focus(); return false; }); And here's the regex I'm using to identify tags (and @mentions) in the PHP back-end, FWIW. %(\A(#|@)(\w|(\p{L}\p{M}?))+\b)|((?<=\s)(#|@)(\w|(\p{L}\p{M}?))+\b)|(\[(#|@).+?\])%u Right now, my main hold-up is dealing with the cursor location. I've researched for the last two hours, and just ended up more confused. I would prefer a jQuery solution, but beggars can't be choosers. Thanks!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >