Search Results

Search found 128 results on 6 pages for 'onfocus'.

Page 2/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • this.select() and javascript events on forms

    - by aloishis89
    I have a form box that I want to be always selected. I was able to get it to select everything in the box when it is clicked (using onFocus="this.select()") but I want it to be selected 100% of the time. The text in the box will be always changing, so I tried using onChange="this.select()" but that didn't work. Here's what I have: <form> <input type="text" id="txt1" size="30" maxlength="1" onkeyup="showHint(this.value)" onFocus="this.select()" onBlur="this.select()" onChange="this.select()" value="Click here, then press a key"/> </form> Basically I just tried to call everything in hopes that something would work, but it is still acting as if only onFocus="this.select()" is there. By the way, this is for controlling something via keyboard, which is why the maxlength is only 1. I want it to be always selected so that when new key are pressed, the last command will be changed without having to use backspace.

    Read the article

  • jquery form validation

    - by kalpaitch
    I am using jquery for a quick and easy form validation My forms use the input's default value as a label and I have a little onfocus and onblur javascript function to show and hide this when the user starts to type: <input name='fnameREG' type='text' id='fnameREG' value='first name' size='70' onfocus='clearInput(this)' onblur='clearInput(this)' /> <input name='lnameREG' type='text' id='lnameREG' value='last name' size='70' onfocus='clearInput(this)' onblur='clearInput(this)' /> My issue with the validation is that when the submit button is clicked the pluggin thinks that all the fields are set because they have a default value. I looked but I couldn't find a supplied method to get round this. Thanks!

    Read the article

  • PHP contact form overwrite fields issue repeating value

    - by judi
    H I'm using php contact form from http://phpfmg.sourceforge.net/home.php. I thought I'd add an onfocus effect so when i click in the fields the value dissappears automatically. But when I submit say if haven't filled in my requried fields I get this the values appearing again like <input type="text" class="text_box" onfocus="if(this.value=='Telephone')this.value='';" value="TelephoneTelephone" id="field_5" name="field_5">

    Read the article

  • Making "helper" text in a form be a different color then typed text.

    - by aslum
    <input name="phone" type="text" id="phone" value="Phone #" onfocus="value=''"> I've got two problems here. The main one is I would like the helper text (in this case "Phone Number") to be a different color then the inputted text from the user, to make it easier for the user to differentiate between filled and unfilled fields. The second is that with this methodology (onfocus="value''") if you mistype something in a field and come back to it you have to retype the whole thing which isn't really acceptable.

    Read the article

  • Can I declare the same value for two attributes at once

    - by graphicdivine
    For example, for accessibility reasons I want my onfocus and onmouseover to have identical values. For the sake of maintainability I want to declare this once only. What I'd like to be able to do is this: <a onmouseover,onfocus="assist('hello');">linktext</a> But, of course, that would be too easy, and doesn't work. What's the best way I can achieve this DRYing out of my tags?

    Read the article

  • Blackberry: How to properly handle focus traversal in custom field?

    - by DaveJohnston
    I am writing an app for Blackberry and I have the following problem: I have implemented a custom field by extending the Manager class. The field is quite simple, it consists of a label and two check boxes, yes and no. The fields are laid out so that the label is on the left and uses as much space as it can while still allowing room for the check boxes which are positioned next to each other at the right and vertically centred compared to the label (if it spans more than one line). So it looks like this: This is a question? O Yes O No Everything is fine so far in terms of laying out the fields. But now I am trying to handle focus traversal. First of all the default behaviour when the user scrolls up or down is to move between the yes and no options. I want to move to the next field above or below when up or down is pressed, so I did this: protected int moveFocus(int amount, int status, int time) { if (status == 537001984 || status == -1610481664) { // Up or down was pressed // Don't move focus between yes and no when up or down is pressed. return amount; } return super.moveFocus(amount, status, time); } And that seems to work. The next thing I would like to do is to remember which option last had the focus when the field loses focus, then on gaining focus again (regardless of which direction the focus comes from) set this field to have the focus. I tried overriding onUnfocus and onFocus so that onUnfocus I note which field was focussed then onFocus setFocus to that field. But I get a StackOverflowError, I guess because the call to setFocus on a field within the manager actually calls onFocus for the manager itself again?? So does anyone know how I should be doing this? I checked the DateField and it has the exact behaviour I am looking for, i.e. it remembers if you were last on the day, month or year field and sets this field to focus when the field itself gets the focus.

    Read the article

  • Changing the <input> type in IE with JavaScript

    - by MrEnder
    The line <input type="text" name="passwordLogin" value="Password" onfocus="if(this.value=='Password'){this.value=''; this.type='password'};" onblur="if(this.value==''){this.value='Password'; this.type='text'};" size="25" /> works in all web browsers except IE... How can I fix it for IE? Ok made some changes to still have an error I want it to work like this like here <input type="text" name="usernameLogin" value="Email" onfocus="if(this.value=='Email'){this.value=''};" onblur="if(this.value==''){this.value='Email'};" size="25" /> if I dont enter anything it will put the value back So I tried this <td colspan="2" id="passwordLoginTd"> <input id="passwordLoginInput1" type="text" name="passwordLogin" value="Password" onfocus="passwordFocus()" size="25" /> <input id="passwordLoginInput2" style="display: none;" type="password" name="passwordLogin" value="" onblur="passwordBlur()" size="25" /> </td> <script type="text/javascript"> //<![CDATA[ passwordElement1 = document.getElementById('passwordLoginInput1'); passwordElement2 = document.getElementById('passwordLoginInput2'); function passwordFocus() { passwordElement1.style.display = "none"; passwordElement2.style.display = "inline"; passwordElement2.focus(); } function passwordBlur() { if(passwordElement2.value=='') { passwordElement2.style.display = "none"; passwordElement1.style.display = "inline"; passwordElement1.focus(); } } //]]> </script> as you can see the blur does not work =[ ok finally got it thanks to the help needed to remove passwordElement1.focus();

    Read the article

  • how to change php functions send result to jquery ajax

    - by OpenCode
    I have many codes for user notifications, it do many mysql works, so it needs waiting times. jquery ajax works for php files. how can i use jquery for send php result to web page? current code : <? echo db_cache("main_top_naver_cache", 300, "naver_popular('naver_popular', 4)"))?> wanted code : but it shows errors... <div id='a'> <div id='b'> <script type="text/javascript"> $("#test1").html( " <? echo htmlspecialchars(db_cache("main_top_naver_cache", 300, "naver_popular('naver_popular', 4)"))?> " ); </script> IE debuger shows error ... SCRIPT1015:... <script type="text/javascript"> $("#test1").html( " &lt;style&gt; /* http://html.nhncorp.com/uio_factory/ui_pattern/list/3 */ .section_ol3{position:relative;border:1px solid #ddd;background:#fff;font-size:12px;font-family:Tahoma, Geneva, sans-serif;line-height:normal;*zoom:1} .section_ol3 a{color:#666;text-decoration:none} .section_ol3 a:hover, .section_ol3 a:active, .section_ol3 a:focus{text-decoration:underline} .section_ol3 em{font-style:normal} .section_ol3 h2{margin:0;padding:10px 0 8px 13px;border-bottom:1px solid #ddd;font-size:12px;color:#333} .section_ol3 h2 em{color:#cf3292} .section_ol3 ol{margin:13px;padding:0;list-style:none} .section_ol3 li{position:relative;margin:0 0 10px 0;*zoom:1} .section_ol3 li:after{display:block;clear:both;content:&quot;&quot;} .section_ol3 li .ranking{display:inline-block;width:14px;height:11px;margin:0 5px 0 0;border-top:1px solid #fff;border-bottom:1px solid #d1d1d1;background:#d1d1d1;text-align:center;vertical-align:top;font:bold 10px Tahoma;color:#fff} .section_ol3 li.best .ranking{border-bottom:1px solid #6e87a5;background:#6e87a5} .section_ol3 li.best a{color:#7189a7} .section_ol3 li .num{position:absolute;top:0;right:0;font-size:11px;color:#a8a8a8;white-space:nowrap} .section_ol3 li.best .num{font-weight:bold;color:#7189a7} .section_ol3 .more{position:absolute;top:10px;right:13px;font:11px Dotum, ??;text-decoration:none !important} .section_ol3 .more span{margin:0 2px 0 0;font-weight:bold;font-size:16px;color:#d76ea9;vertical-align:middle} &lt;/style&gt; &lt;div class=&quot;section_ol3&quot;&gt; &lt;ol style='text-align:left;'&gt; &lt;li class='best'&gt;&lt;span class='ranking'&gt;1&lt;/span&gt;&lt;a href='http://search.naver.com/search.naver?where=nexearch&amp;query=%B9%AB%C7%D1%B5%B5%C0%FC&amp;sm=top_lve' onfocus='this.blur()' title='????' target=new&gt;????&lt;/a&gt;&lt;span class='num'&gt;+42&lt;/span&gt;&lt;/li&gt;&lt;li class='best'&gt;&lt;span class='ranking'&gt;2&lt;/span&gt;&lt;a href='http://search.naver.com/search.naver?where=nexearch&amp;query=%B1%E8%C0%E7%BF%AC&amp;sm=top_lve' onfocus='this.blur()' title='???' target=new&gt;???&lt;/a&gt;&lt;span class='num'&gt;+123&lt;/span&gt;&lt;/li&gt;&lt;li class='best'&gt;&lt;span class='ranking'&gt;3&lt;/span&gt;&lt;a href='http://search.naver.com/search.naver?where=nexearch&amp;query=%C0%CC%C7%CF%C0%CC&amp;sm=top_lve' onfocus='this.blur()' title='???' target=new&gt;???&lt;/a&gt;&lt;span class='num'&gt;+90&lt;/span&gt;&lt;/li&gt;&lt;li &gt;&lt;span class='ranking'&gt;4&lt;/span&gt;&lt;a href='http://search.naver.com/search.naver?where=nexearch&amp;query=%BA%D2%C8%C4%C0%C7%B8%ED%B0%EE2&amp;sm=top_lve' onfocus='this.blur()' title='?????2' target=new&gt;?????2&lt;/a&gt;&lt;span class='num'&gt;+87&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; </div> " );

    Read the article

  • jQuery for dynamic Add/Remove row function, it's clone() objcet cannot modify element name

    - by wcy0942
    I'm try jQuery for dynamic Add/Remove row function, but I meet some question in IE8 , it's clone() objcet cannot modify element name and cannot use javascript form (prhIndexed[i].prhSrc).functionKey, but in FF it works very well, source code as attachment, please give me a favor to solve the problem. <html> $(document).ready(function() { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Define some variables - edit to suit your needs //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // table id var _table = jQuery("#prh"); // modify here // tbody tbody var _tableBody = jQuery("tbody",_table); // buttons var _addRowBtn = jQuery("#controls #addRow"); var _insertRowBtn= jQuery("#controls #insertRow"); var _removeRowBtn= jQuery("#controls #removeRow"); //check box all var _cbAll= jQuery(".checkBoxAll", _table ); // add how many rows var _addRowsNumber= jQuery("#controls #add_rows_number"); var _hiddenControls = jQuery("#controls .hiddenControls"); var blankRowID = "blankRow"; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //click the add row button //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _addRowBtn.click(function(){ // when input not isNaN do add row if (! isNaN(_addRowsNumber.attr('value')) ){ for (var i = 0 ; i < _addRowsNumber.attr('value') ;i++){ var newRow = jQuery("#"+blankRowID).clone(true).appendTo(_tableBody) .attr("style", "display: ''") .addClass("rowData") .removeAttr("id"); } refreshTable(_table); } return false; //kill the browser default action }); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //checkbox select all //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _cbAll.click(function(){ var checked_status = this.checked; var prefixName = _cbAll.attr('name'); // find name prefix match check box (group of table) jQuery("input[name^='"+prefixName+"']").each(function() { this.checked = checked_status; }); }); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Click the remove all button //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _removeRowBtn.click(function(){ var prefixName = _cbAll.attr('name'); // find name prefix match check box (group of table) jQuery("input[name^='"+prefixName+"']").not(_cbAll).each(function() { if (this.checked){ // remove tr row , ckbox name the same with rowid jQuery("#"+this.name).remove(); } }); refreshTable(_table); return false; }); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Click the insert row button //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _insertRowBtn.click(function(){ var prefixName = _cbAll.attr('name'); jQuery("input[name^='"+prefixName+"']").each(function(){ var currentRow = this.name;// ckbox name the same with rowid if (this.checked == true){ newRow = jQuery("#"+blankRowID).clone(true).insertAfter(jQuery("#"+currentRow)) .attr("style", "display: ''") .addClass("rowData") .removeAttr("id"); } }); refreshTable(_table); return false; }); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Function to refresh new row //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function refreshTable(_table){ var tableId = _table.attr('id'); var count =1; // ignore hidden column // update tr rowid jQuery ( "#"+tableId ).find(".rowData").each(function(){ jQuery(this).attr('id', tableId + "_" + count ); count ++; }); count =0; jQuery ( "#"+tableId ).find("input[type='checkbox'][name^='"+tableId+"']").not(".checkBoxAll").each(function(){ // update check box id and name (not check all) jQuery(this).attr('id', tableId + "_ckbox" + count ); jQuery(this).attr('name', tableId + "_" + count ); count ++; }); // write customize code here customerRow(_table); }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Function to customer new row : modify here //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ function customerRow(_table){ var form = document.myform; var pageColumns = ["prhSeq", "prhChannelproperty", "prhSrc"]; //modify here var tableId = _table.attr('id'); var count =1; // ignore hidden column // update tr rowid jQuery ( "#"+tableId ).find(".rowData").each(function(){ for(var i = 0; i < pageColumns.length; i++){ jQuery ( this ).find("input[name$='"+pageColumns[i]+"']").each(function(){ jQuery(this).attr('name', 'prhIndexed['+count+'].'+pageColumns[i] ); // update prhSeq Value if (pageColumns[i] == "prhSeq") { jQuery(this).attr('value', count ); } if (pageColumns[i] == "prhSrc") { // clear default onfocus //jQuery(this).attr("onfocus", ""); jQuery(this).focus(function() { // doSomething }); } }); jQuery ( this ).find("select[name$='"+pageColumns[i]+"']").each(function(){ jQuery(this).attr('name', 'prhIndexed['+count+'].'+pageColumns[i] ); }); }// end of for count ++; }); jQuery ( "#"+tableId ).find(".rowData").each(function(){ // only for debug alert ( jQuery(this).html() ) }); }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }); <div id="controls"> <table width="350px" border="0"> <tr><td> <input id="addRow" type="button" name="addRows" value="Add Row" /> <input id="add_rows_number" type="text" name="add_rows_number" value="1" style="width:20px;" maxlength="2" /> <input id="insertRow" type="button" name="insert" value="Insert Row" /> <input id="removeRow" type="button" name="deleteRows" value="Delete Row" /> </td></tr> </table></div> <table id="prh" width="350px" border="1"> <thead> <tr class="listheader"> <td nowrap width="21"><input type="checkbox" name="prh_" class="checkBoxAll"/></td> <td nowrap width="32">Sequence</td> <td nowrap width="153" align="center">Channel</td> <td nowrap width="200">Source</td> </tr> </thead> <tbody> <!-- dummy row --> <tr id='blankRow' style="display:none" > <td><input type="checkbox" id='prh_ckbox0' name='prh_0' value=""/></td> <td align="right"><input type="text" name="prhIndexed[0].prhSeq" maxlength="10" value="" onkeydown="" onblur="" onfocus="" readonly="readonly" style="width:30px;background-color:transparent;border:0;line-height:13pt;color: #993300;background-color:transparent;border:0;line-height:13pt;color: #993300;"></td> <td><select name="prhIndexed[0].prhChannelproperty"><option value=""></option> <option value="A01">A01</option> <option value="A02">A02</option> <option value="A03">A03</option> <option value="A04">A04</option> </select></td> <td><input type="text" name="prhIndexed[0].prhSrc" maxlength="6" value="new" style="width:80px;background-color:#FFFFD7;"> <div id='displayPrhSrcName0'></div> </td> </tr> <!-- row data --> <tr id='prh_1' class="rowData"> <td><input type="checkbox" id='prh_ckbox1' name='prh_1' value=""/></td> <td align="right"><input type="text" name="prhIndexed[1].prhSeq" maxlength="10" value="1" onkeydown="" onblur="" onfocus="" readonly="readonly" style="width:30px;background-color:transparent;border:0;line-height:13pt;color: #993300;background-color:transparent;border:0;line-height:13pt;color: #993300;"></td> <td><select name="prhIndexed[1].prhChannelproperty"><option value=""></option> <option value="A01">A01</option> <option value="A02">A02</option> <option value="A03">A03</option> <option value="A04">A04</option> </select></td> <td><input type="text" name="prhIndexed[1].prhSrc" maxlength="6" value="new" style="width:80px;background-color:#FFFFD7;"> <div id='displayPrhSrcName0'></div> </td> </tr> <tr id='prh_2' class="rowData"> <td><input type="checkbox" id='prh_ckbox2' name='prh_2' value=""/></td> <td align="right"><input type="text" name="prhIndexed[2].prhSeq" maxlength="10" value="2" onkeydown="" onblur="" onfocus="" readonly="readonly" style="width:30px;background-color:transparent;border:0;line-height:13pt;color: #993300;background-color:transparent;border:0;line-height:13pt;color: #993300;"></td> <td><select name="prhIndexed[2].prhChannelproperty"><option value=""></option> <option value="A01">A01</option> <option value="A02">A02</option> <option value="A03">A03</option> <option value="A04">A04</option> </select></td> <td><input type="text" name="prhIndexed[2].prhSrc" maxlength="6" value="new" style="width:80px;background-color:#FFFFD7;"> <div id='displayPrhSrcName0'></div> </td> </tr> </tbody> </table>

    Read the article

  • My FORM problem issues

    - by Azzyh
    So i have this in my form: <textarea onfocus="javascript:clearContents(this);" rows="5" cols="40" id="comment" name="comment">Skriv hvorfor du vælger at stemme ja/nej. Skal indeholde detaljer, kritik/råd. Klik for at skrive</textarea><br /> Ja: <input type="checkbox" value="Y" id="SCvote" name="SCvote"> eller Nej: <input type="checkbox" value="N" name="SCvote"> Now onfocus (when you click on the box) it clears the text "Skriv hvorfor...", but if you dont write anything and still submit it, my php code thinks it contains something and inserts that text "Skriv hvorfor...". And another issue is the checkboxes. If i dont pick anything, it inserts "Y", even if i pick the other "N" it does "Y", and i dont want it to be possible that you can check both of them. how do i do?

    Read the article

  • File input javascript event, is there an event fire when someone click okay on the dialog box?

    - by Mickey Cheong
    Hi, When someone click on Browse for the input file below: <input type="file" name="blah" /> A dialog box will appear. The user will then select a file and click 'Ok'. The dialog box will close. Is there an event fire because of that? I tried onfocus and onblur, it didnt work out. The only way is, i start a timer to check the value content when it is onfocus. Not that elegant. Any solution? Cheers, Mickey

    Read the article

  • autocomplete attribute is not passing XHTML 1.0 Transitional validation, why?

    - by rsturim
    I'm trying to cleanup my xhtml validation -- I'm running my pages through the W3C validator. For some puzzling reason it's not passing on input fields with the autocomplete="off" attribute: <input name="kwsearch" id="sli_search_1" type="text" autocomplete="off" onfocus="if(this.defaultValue==this.value) this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" class="searchbox" value="Search" /> I'm using this doctype: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> And this is the validation error: Line 410, Column 81: there is no attribute "autocomplete" …li_search_1" type="text" autocomplete="off" onfocus="if(this.defaultValue==thi… I thought this was okay with the W3C -- but, maybe it's still in "submission" phase? http://www.w3.org/Submission/web-forms2/#autocomplete Thoughts?

    Read the article

  • VB.net Enter Key

    - by Andrew
    I was given the following pseudo code in order to get the form that has focus and only allow the form I want to be submitted: <script> var currentForm = document.forms[0];</script> <form ...><input onfocus="currentForm = this.form;"/></form> <form ...><input onfocus="currentForm = this.form;"/></form> function globalKeyPressed(event) { if (event.keyCode == ENTER) { // This is pseudo-code, check how to really do it currentForm.submit(); } } How would I do this for VB.net because VB.net doesn't accept System.Windows.Forms.KeyPressEventArgs. I also wanted to add that I can't have multiple forms on my website as it disrupts the loginview. So my 2 seperate 'forms' are really just a loginview and then an asp:textbox and asp:button by themselves without a form.

    Read the article

  • How do I change the style of an input box in IE7 on focus?

    - by Cen
    I know IE7 has issues... I've read posts here and on Google telling me I need to set the style by hand onfocus() and onblur(). However, everything I try isn't working! Here is my jQuery $(document).ready(function(){ if (jQuery.browser.msie === true) { $("input.date-picker").each(function(i) { var $foo= $(this); $foo.bind('onfocus onblur', function() { $(this).toggleClass('smalltxt-active'); }); }); }//end if }); The a corresponding box <input name="ctl00$SelectionContent$Selections1$txtDestinationDate" type="text" id="ctl00_SelectionContent_Selections1_txtDestinationDate" class="date-picker" style="width:80px;" /> I have already confirmed that my code is detecting MSIE. That I am getting a count of 2 input.date-picker objects. Any ideas? Thanks in advance,

    Read the article

  • {textarea} smarty php

    - by Kyle Sevenoaks
    Hi, further to a previous question, I have this code: {textarea onblur="if(this.value=='') this.value='Skriv her';" onfocus="if(this.value=='Skriv her') this.value='';"} And I want the output to be <textarea onblur="if(this.value=='') this.value='Skriv her';" onfocus="if(this.value=='Skriv her') this.value='';">Write here!</textarea> I tried [/textarea} but it didn't work in my template file. Is it possible to make this in smarty/php? Thanks :)

    Read the article

  • Robust Way of Selecting All Text in Textbox

    - by Emil
    I'm trying to have the content of the an HTML textbox be selected fully onFocus. I know the simple solution of putting a onfocus="this.select()" on the component but this is not a good solution because if a user double clicks into the area the selection is lost and in browsers like chrome it is rarely working like it should and just reverts into input form. I have searched on Google for a little while and can't find a good solution, most suggestions are of this simple solution. What I would like it is that the selection inside the textbox not change once selected and if possible the user should not be able to edit the content of the textbox, for example if you have used AdSense when you grab code from AdSense the selection never changes and your unable to alter the code in the textbox. Any solutions would be appreciated.

    Read the article

  • Javascript onsubmit clearcontent not working.

    - by Azzyh
    <textarea onfocus=" javascript:clearContents(this); this.cleared=true;" rows="5" cols="40" id="comment" name="comment" <?php if($vis["username"] == $pusername) { echo "DISABLED"; } ?>>...</textarea> <input onsubmit="if (!this.comment.cleared) clearContents(this.comment); return true;" type="submit" name="Submit" value="Stem!"/> function clearContents(element) { element.innerHTML = ''; } This wont work, and i cant figure out why. What it does: clears the content if it hasnt been onfocus/clicked on by the person

    Read the article

  • Slick2D, Nifty GUI listeners problem

    - by Patokun
    I'm trying to get Nifty GUI to work with Slick2D. So far everything is going great, except that I can't seem to figure out how to properly interact with the GUI. I'm trying the example in the nifty manual http://sourceforge.n....0.pdf/download but it doesn't seem to entirely work. The Element controller is being called for bind(...), init(...) and onStartScreen() as it should, as I can see their println output, but the next() method isn't being called when I click on the GUI element that I assigned the controller to, nor the screen controller as no output from println is shown. What's weird is, that the player is moving, so the mouse input is working. It's supposed to be called when I click the mouse button on it from the in the XML. Here is my code: My Element controller: public class ElementController implements Controller { private Element element; @Override public void bind(Nifty nifty, Screen screen, Element element, Properties parameter, Attributes controlDefinitionAttributes) { this.element = element; System.out.println("bind() called for element: " + element); } @Override public void init(Properties parameter, Attributes controlDefinitionAttributes) { System.out.println("init() called for element: " + element); } @Override public void onStartScreen() { System.out.println("onStartScreen() alled for element: " + element); } @Override public void onFocus(boolean getFocus) { System.out.println("onFocus() called for element: " + element + ", with: " + getFocus); } @Override public boolean inputEvent(NiftyInputEvent inputEvent) { return false; } public void next() { System.out.println("next() clicked for element: " + element); } } MyScreenController: class MyScreenController implements ScreenController { public void bind(Nifty nifty, Screen screen) {} public void onEndScreen() {} public void onStartScreen() {} public void next() { System.out.println("next() called from MyScreenController"); } } And my XML file: <?xml version="1.0" encoding="UTF-8"?> <nifty xmlns="http://nifty-gui.sourceforge.net/nifty-1.3.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://niftygui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd"> <screen id="start" controller="predaN00b.theThing.V0004.MyScreenController"> <layer childLayout="center" controller="predaN00b.theThing.V0004.ElementController"> <panel width="100px" height="100px" childLayout="vertical" backgroundColor="#ff0f"> <text font="aurulent-sans-16.fnt" color="#ffff" text="Hello World!"> <interact onClick="next()" /> </text> </panel> </layer> </screen> </nifty> My main class, in case it's needed: public class MainGameState extends BasicGame { public Nifty nifty; public MainGame() { super("Test"); } public void init(GameContainer container, StateBasedGame game) throws SlickException { nifty = new Nifty(new SlickRenderDevice(container), new NullSoundDevice(), new PlainSlickInputSystem(), new AccurateTimeProvider()); nifty.addXml("/xml/MainState.xml"); nifty.gotoScreen("start"); } public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException { nifty.update(); } public void render(GameContainer container, StateBasedGame game, Graphics graphics) throws SlickException { nifty.render(false); } public static void main(String[] args) throws SlickException { AppGameContainer app = new AppGameContainer(new MainGame()); app.setAlwaysRender(true); app.setDisplayMode( 1260 , 720, false); //window size app.start(); } }

    Read the article

  • Change ObjectChoiceField Color not working on Blackberry OS 5.0

    - by Ari R. Fikri
    I want to create a custom ObjectChoiceField, the expected behavior is if the data change then upon leavinge the focus the font color will change. I have succeded in BB OS upto 4.7 but when tested on simulator and on real device with BB OS 5.0 the color won't change. This is my class : public class MyObjectChoiceField extends ObjectChoiceField { int color; Object oldValue, newValue; boolean isChanged; public MyObjectChoiceField(){ super(); oldValue = new Object(); newValue = new Object(); } public MyObjectChoiceField(int color, String label, String[] choices, int intP, long styleP){ super(label, choices, intP, styleP); this.color = color; } public void onUnfocus(){ if (getSelectedIndex() != -1){ newValue = getChoice(getSelectedIndex()); if (oldValue != newValue){ isChanged = true; invalidate(); } } super.onUnfocus(); } public void onFocus(int directionInt){ if (getSelectedIndex() != -1) oldValue = getChoice(getSelectedIndex()); super.onFocus(directionInt); } public void paint(Graphics g){ if (isChanged){ g.setColor(this.color); } super.paint(g); } What should I do to make this also work on BB OS 5.0. FYI : The ObjectChoiceField in BB 5.0 is look like a button with a triangle point down in the right side, which is different with BB OS 4.7.

    Read the article

  • Firefox/vista not showing div tag

    - by flavour404
    Hi, I have a div tag which should be displayed at the bottom of a page given a set of circumstances. On my machine XP/IE, chrome, firefox, opera (all latest versions) the div shows up fine. But on my bosses machine, running vista with Firefox 3.6 for some reason the div tag is not showing up. However, if i go to another machine with vista and firefox the div tag shows up fine. My question is, what could have been set in firefox that would cause this div tag to now be displayed. It is there, if you resize the window then the tag flickers into view and then disappears again... <div id="savePane" style="position:absolute;left:0px;top:457px;width:100%;height:40px;border-top:#EFECDC 1px solid;padding:5px; visibility:visible;"> <table width="100%"> <tr> <td width="130" align="left"> Ad Description: </td> <td align="left"> <input type="text" id="adDescription" style="width: 270px" onfocus="skipcycle=true;loadThumbnail(<%=AdToSaveID%>);" onblur="skipcycle=false;"> </td> <td align="right"> <% 'onblur='skipcycle=false' onfocus='skipcycle=true' is needed to do not focus on SaveToFolder window when user enter data to that window but focus on that input box instead %> <input type="button" onclick="saveItemToSelectedFolder('<%=AdToSaveID%>', '<%=AdNumber%>', '<%=Sequencer%>', '<%=PageNumber%>', '<%=Section%>', '<%=Zone%>', '<%=RunDate%>', '<%=PublicationID%>')" value="Save" style="width: 70px; margin-right: 10px" /> </td> </tr> </table> Thanks, Ron.

    Read the article

  • Control Attributes render Encoded on dot net 4 - how to disable the encoding ?

    - by Aristos
    I have an issue in asp.net 4. When I add an attribute on controls, then the render it encoded. For example, when I type this code txtQuestion.Attributes["onfocus"] = "if(this.value == this.title) { this.value = ''; this.style.backgroundColor='#FEFDE0'; this.style.color='#000000'; }"; I get render onfocus="if(this.value == this.title){this.value = &#39;&#39;;this.style.backgroundColor=&#39;#FEFDE0&#39;; this.style.color=&#39;#000000&#39;;}" And every ' hash been change to & #39; Is there a way to disable this new future only on some controls ? or an easy way to make a custom render ? My Fail tries I have all ready try some thinks but I fail. For example this fails. txtQuestion.RenderingCompatibility = new Version("3.5"); I also locate the point that this attributes renders and is on public virtual void RenderBeginTag(HtmlTextWriterTag tagKey) function, there every attribute have a flag if he wish to be encoded, but I do not know how can anyone set it or not. Anyway, thank you in advanced.

    Read the article

  • adding an uncertain number of fields using javascript

    - by user306472
    I'm new to javascript and a novice programmer, so this might be a really easy question to answer. I would like to loop over the values of x number of fields and add them up to display the sum in a final field. I can perform this function if I explicitly call each field, but I want to abstract this so I can deal with a flexible number of fields. Here's example code I've come up with (that's not working for me). Where am I going wrong? <html> <head> <script type="text/javascript"> function startAdd(){ interval = setInterval("addfields()",1); } function addfields(){ a = document.addition.total.value; b = getElementByTagName("sum").value; for (i=0; i<=b.length; i++){ a+=i; } return a; } function stopAdd(){ clearInterval(interval); } </script> </head> <body> <form name="addition"> <input type="text" name="sum" onFocus="startAdd();" onBlur="stopAdd;"> + <input type="text" name="sum" onFocus="startAdd();" onBlur="stopAdd;"> = <input type="text" name ="total"> </form> </body> </html>

    Read the article

  • Submit to open up a popup window and carry through input data

    - by zac
    Hi, I have a input box on one page that on submit opens a new page with a longer form and the first field is populated with what was entered from the previous pages input box. So on page 1 there is this code: <form action="sign-up.php"> <input type="text" name="email" value="sign up for email" onFocus="clearText(this)" onBlur="clearText(this)" style="float: left;"> <input value='Submit' /> </form> Then on the sign-up page the receiving form grabs the string out of the url //<!-- Begin function getParams() { var idx = document.URL.indexOf('?'); if (idx != -1) { var tempParams = new Object(); var pairs = document.URL.substring(idx+1,document.URL.length).split('&'); for (var i=0; i<pairs.length; i++) { nameVal = pairs[i].split('='); tempParams[nameVal[0]] = nameVal[1]; } return tempParams; } } var params = getParams(); // End --> I would like to keep all of this functionality but it have it occur in a popup. I added this function to the submit: function myPopup() { window.open( "sign-up.php", "myWindow", "status = 1, height = 300, width = 300, resizable = 0" ) and the form becomes <form> <input type="text" name="email" value="sign up for email" onFocus="clearText(this)" onBlur="clearText(this)" style="float: left;"> <input onClick="myPopup()" value='Submit' /> </form> But it no longer appends the input data to the url string. Anyone have any ideas on how I can accomplish this?

    Read the article

  • CustomButton Field not aligning in the center

    - by rupesh
    Hi all I have created a custom button and i am placing the bunch of Custombuttons in a verticalfieldManager , I have aligned the verticalField Manager in the center. when i am creating a default buttonField then verticalfield Manager is able to align the buttonfield in the center. but when i am assigning custombuttonfield in the verticalField Manager it's not aligning in the center. here is my custombuttoncode enter code herepublic CustomButtonField(String label,long style) { super(style); this.label = label; onPicture = Bitmap.getBitmapResource(onPicturePath); font = getFont(); this.setPadding(5,5, 5, 5); } public String getLabel() { return label; } public int getPreferredHeight() { return onPicture.getHeight(); } public int getPreferredWidth() { return onPicture.getWidth(); } protected void layout(int width , int height) { setExtent(Math.min(width, Display.getWidth()), Math.min(height,getPreferredHeight())); } protected void paint(Graphics graphics) { int texty =(getHeight()-getFont().getHeight())/2; if (isFocus()) { graphics.setColor(Color.BLACK); graphics.drawBitmap(0, 0, getWidth(), getHeight(),onPicture , 0, 0); graphics.setColor(Color.WHITE); graphics.setFont(font); graphics.drawText(label,0,texty,DrawStyle.ELLIPSIS,getWidth()); } else { graphics.drawBitmap(0, 0, getWidth(), getHeight(),onPicture , 0, 0); graphics.setColor(Color.WHITE); graphics.setFont(font); graphics.drawText(label,0,texty,DrawStyle.ELLIPSIS,getWidth()); } } public boolean isFocusable() { return true; } protected void onFocus(int direction) { super.onFocus(direction); invalidate(); } protected void onUnfocus() { super.onUnfocus(); invalidate(); } protected boolean navigationClick(int status, int time) { fieldChangeNotify(0); return true; } protected boolean keyChar(char character, int status, int time) { if (character == Keypad.KEY_ENTER) { fieldChangeNotify(0); return true; } return super.keyChar(character, status, time); } }

    Read the article

  • how can i check ID of a clicked element js

    - by necker
    how can i check if an ID of a clicked element is lets say 'target'. what i am trying to do is actually show and hide comment form on clicking in the text field and hide it when the user clicks out of the form. the problem is that if the user clicks Submit button the form hides and nothing is sent over. so i'll have to check if the submit buttons id matches the clicked element and not hide it in this case. i am using ruby on rails remote_form_for and onblur and onfocus events now. this is my bigger form that i am showing. <div id="bigArea" style="display:none"> <% remote_form_for @horses do |f|%> <%= f.text_area :description, {:onBlur=>"{$(bigArea').hide();$('smallField').show();}"} %> <%= f.submit "Submit"%> <% end %> </div> and this is the smaller form field that hides everytime you click in it. <div id="smallField"> <%= text_field_tag 'sth',"Click to comment, {:onFocus=>"$('bigArea').show();$('smallField').hide();"} %> </div> My question is how can i disallow the form to hide when a user clicks submit button? i suppose i should check which element's id has been clicked. and if it's submit button's ID i should not hide the form. Or maybe there is some other way to do all this? i would greatly appreciate any answers!

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >