Search Results

Search found 443 results on 18 pages for 'cols'.

Page 12/18 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Using javascript to add form fields, but what will the new name be?

    - by user1322844
    After reading this post: using javascript to add form fields.. but below, not to the side? I've made the button work! But I don't know how to receive the output. This is what I entered. var counter = 0; function addNew() { // Get the main Div in which all the other divs will be added var mainContainer = document.getElementById('mainContainer'); // Create a new div for holding text and button input elements var newDiv = document.createElement('div'); // Create a new text input var newText = document.createElement('input'); newText.type = "input"; newText.maxlength = "50"; newText.maxlimit = "50"; newText.size = "60"; newText.value = counter; // Create a new button input var newDelButton = document.createElement('input'); newDelButton.type = "button"; newDelButton.value = "Delete"; // Append new text input to the newDiv newDiv.appendChild(newText); // Append new button input to the newDiv newDiv.appendChild(newDelButton); // Append newDiv input to the mainContainer div mainContainer.appendChild(newDiv); counter++; // Add a handler to button for deleting the newDiv from the mainContainer newDelButton.onclick = function() { mainContainer.removeChild(newDiv); } } </script> With this in the form: <input type="button" size="3" cols="30" value="Add" onClick="addNew()"> So, what will the new field names be? I don't understand enough of the coding to figure out what I'm telling it to. Good thing there are other smart folks out there for me to lean on! Thanks for any answers.

    Read the article

  • TEXTAREAs scroll by themselves (on IE8) every time you type one character

    - by Justin Grant
    IE8 has a known bug (per connect.microsoft.com) where typing or pasting text into a TEXTAREA element will cause the textarea to scroll by itself. This is hugely annoying and shows up in many community sites, including Wikipedia. The repro is this: open the HTML below with IE8 (or use any long page on wikipedia which will exhibit the same problem until they fix it) size the browser full-screen paste a few pages of text into the TEXTAREA move the scrollbar to the middle position now type one character into the textarea Expected: nothing happens Actual: scrossing happens on its own, and the insertion point ends up near the bottom of the textarea! Below is repro HTML (can also see this live on the web here: http://en.wikipedia.org/w/index.php?title=Text_box&action=edit) <!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" > <body> <div style="width: 80%"> <textarea rows="20" cols="80" style="width:100%;" ></textarea> </div> </body> </html>

    Read the article

  • doubt in javascript name validation

    - by raja
    Hi: I am using the below validation for textbox which accepts only alphabets and maximum of 50 characters. I am passing the object directly in the parameter. The below case by giving the field name i.e "my_text" directly is working is working fine. But if i pass it in variable, that time it is not working(commented the if statement). Please help me. My requirement is each time when we enter the charater, the hardcode field name should not be used in the validation. <html><head> <script language=JavaScript> function check_length(my_form,fieldName) { alert(fieldName); // if (my_form.fieldName.value.length >= maxLen) { if (my_form.my_text.value.length >= maxLen) { var msg = "You have reached your maximum limit of characters allowed"; alert(msg); my_form.my_text.value = my_form.my_text.value.substring(0, maxLen); } else{ var keyCode = window.event.keyCode; if ((keyCode < 65 || keyCode > 90) && (keyCode < 97 || keyCode > 123) && keyCode != 32) { window.event.returnValue = false; alert("Enter only Alphabets"); } my_form.text_num.value = maxLen - my_form.my_text.value.length;} } </script> </head> <body> <form name=my_form method=post> <input type="text" onKeyPress=check_length(this.form,this.name); name=my_text rows=4 cols=30> <br> <input size=1 value=50 name=text_num> Characters Left </form> </body> </html>

    Read the article

  • What is the easiest way to get the property value from a passed lambda expression in an extension me

    - by Andrew Siemer
    I am writing a dirty little extension method for HtmlHelper so that I can say something like HtmlHelper.WysiwygFor(lambda) and display the CKEditor. I have this working currently but it seems a bit more cumbersome than I would prefer. I am hoping that there is a more straight forward way of doing this. Here is what I have so far. public static MvcHtmlString WysiwygFor<TModel, TProperty>(this HtmlHelper<TModel> helper, Expression<Func<TModel, TProperty>> expression) { return MvcHtmlString.Create(string.Concat("<textarea class=\"ckeditor\" cols=\"80\" id=\"", expression.MemberName(), "\" name=\"editor1\" rows=\"10\">", GetValue(helper, expression), "</textarea>")); } private static string GetValue<TModel, TProperty>(HtmlHelper<TModel> helper, Expression<Func<TModel, TProperty>> expression) { MemberExpression body = (MemberExpression)expression.Body; string propertyName = body.Member.Name; TModel model = helper.ViewData.Model; string value = typeof(TModel).GetProperty(propertyName).GetValue(model, null).ToString(); return value; } private static string MemberName<T, V>(this Expression<Func<T, V>> expression) { var memberExpression = expression.Body as MemberExpression; if (memberExpression == null) throw new InvalidOperationException("Expression must be a member expression"); return memberExpression.Member.Name; } Thanks!

    Read the article

  • Is CakePhp 'standards compliant' when generating HTML, Forms, etc?

    - by dtj
    So I've been reading a lot of "Designing with Web Standards" and really enjoying it. I'm a big CakePhp user, and as I look at the source for various form elements that Cake creates with its FormHelper, I see all sorts of extraneous In the book, he promotes semantic HTML, and writing your markup as simple / generic as possible. So my question is, am I better writing my own HTML in these situations? I really want to work in compliance with XHTML and CSS standards, and it seems I'd spend just as much time (if not more) cleaning up Cakes HTML, when I could just write my own thoughts? p.s. Here's an example in an out of the box form that CakePhp generates using the FormHelper <form id="CompanyAddForm" method="post" action="/omni_cake/companies/add" accept-charset="utf-8"><div style="display:none;"><input type="hidden" name="_method" value="POST" /></div> <div class="input text required"><label for="CompanyName">Name</label><input name="data[Company][name]" type="text" maxlength="50" id="CompanyName" /></div> <div class="input text required"><label for="CompanyWebsite">Website</label><input name="data[Company][website]" type="text" maxlength="50" id="CompanyWebsite" /></div> <div class="input textarea"><label for="CompanyNotes">Notes</label><textarea name="data[Company][notes]" cols="30" rows="6" id="CompanyNotes" ></textarea></div> <div class="submit"><input type="submit" value="Submit" /></div></form>

    Read the article

  • HTML form with table cell height problem

    - by Parhs
    Hello.. I have several forms like this: <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_std"> <tr id="exam_String_newValue_row"> <td width="150" class="table_defaultHeaderColumn">????a????sµ??? ??µ??</td> <td width="802" class="table_defaultHeaderColumn" > <textarea name="textarea" id="textarea" cols="45" rows="5"></textarea> </td> </tr> <tr> <td width="150" class="table_defaultHeaderColumn">??????s? - ??????</td> <td width="802"> <input name="Exam_String_value" type="text" style="width:600px" id="textfield2" /> </td> </tr> <tr> <td width="150" class="table_defaultHeaderColumn">??????s? - ?e?d??</td> <td width="802"> <input name="Exam_String_value" type="text" style="width:600px" id="textfield2" /> </td> </tr> </table> css .table_defaultHeaderColumn { font-size: 11px; } .input_std { width: 200px; } .input_small { width: 4em; } .table_std { border-collapse:collapse; } .table_std td { padding-top: 1px; padding-bottom: 1px; } The problem is the height of the cells.... isnt equal in all browsers... any solution?

    Read the article

  • HTML: Nesting DIVs problem

    - by mawg
    I am coding a form generator. So far, so good, then I decided to give it a real test. I made a form with some nested each holding a few controls. I will post the HTML at the end. If you load it into a browser, it renders, but is obviously wrong. I had previously tested using the W3C validator and things were fine, but that was for non nested. When I validate a form with nested I get errors: Error Line 13, Column 117: document type does not allow element "DIV" here …style="position: absolute; top:88px; left: 256px; width: 145px; height: 21px;"> So, how do I correct that? What do I do with nested FIELDSETs? Here's the complete HTML <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title></title> <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> </head> <body> <form action="C:\temp\an_elogger_test.php" method="get"><div class="TGroupBox" id="GroupBox1"> <fieldset style="position: absolute; top:24px; left:24px; width: 449px; height: 473px;"> <legend>GroupBox1</legend> <div class="TPanel" id="Panel1"> <fieldset style="position: absolute; top:64px; left:64px; width: 361px; height: 217px;"> <div class="TComboBox" id="ComboBox1" style="position: absolute; top:88px; left: 256px; width: 145px; height: 21px;"> <select name="ComboBox1"> </select> </div> <div class="TGroupBox" id="GroupBox2"> <fieldset style="position: absolute; top:80px; left:88px; width: 145px; height: 177px;"> <legend>GroupBox2</legend> <div class="TCheckBox" id="CheckBox1" style="position: absolute; top:112px; left: 104px; width: 97px; height: 17px;">CheckBox1<input type="checkbox" name="CheckBox1" value="CheckBox1Checked"></div> <div class="TCheckBox" id="CheckBox2" style="position: absolute; top:152px; left: 112px; width: 97px; height: 17px;">CheckBox2<input type="checkbox" name="CheckBox2" value="CheckBox2Checked"checked="checked"></div> </fieldset> </div> <div class="TRadioGroup" id="RadioGroup2"> <fieldset style="position: absolute; top:128px; left: 264px; width: 145px; height: 137px;"><legend>RadioGroup2</legend> eins: <input type="radio" name="RadioGroup2" value="eins" checked><br> zwei: <input type="radio" name="RadioGroup2" value="zwei"><br> drei: <input type="radio" name="RadioGroup2" value="drei"><br> </fieldset> </div> </fieldset> </div> <div class="TMemo" id="Memo1"><textarea name="Memo1" rows="8" cols="13" style="position: absolute; top:320px; left: 88px; width: 185px; height: 89px;"> </textarea> </div> <div class="TComboBox" id="ComboBox2" style="position: absolute; top:328px; left: 296px; width: 145px; height: 21px;"> <select name="ComboBox2"> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> <option value="d" selected="selected">d</option> <option value="e">e</option> </select> </div> </fieldset> </div> <div class="TPanel" id="Panel2"> <fieldset style="position: absolute; top:32px; left:520px; width: 425px; height: 449px;"> <div class="TPanel" id="Panel3"> <fieldset style="position: absolute; top:64px; left:552px; width: 345px; height: 185px;"> <div class="TMemo" id="Memo2"><textarea name="Memo2" rows="8" cols="13" style="position: absolute; top:88px; left: 584px; width: 185px; height: 89px;"> You may wish to leave this memo emptyOr perpahaps give instructions aboout what should be written here</textarea> </div> <div class="TEdit" id="Edit1" style="position: absolute; top:200px; left: 600px; width: 121px; height: 21px;"><input type="text" name="Edit1"value="Insert text here"></div> </fieldset> </div> <div class="TGroupBox" id="GroupBox3"> <fieldset style="position: absolute; top:272px; left:552px; width: 345px; height: 185px;"> <legend>GroupBox3</legend> <div class="TPanel" id="Panel4"> <fieldset style="position: absolute; top:304px; left:584px; width: 177px; height: 137px;"> <div class="TRadioGroup" id="RadioGroup1"> <fieldset style="position: absolute; top:312px; left: 600px; width: 97px; height: 105px;"><legend>RadioGroup1</legend> one: <input type="radio" name="RadioGroup1" value="one"><br> two: <input type="radio" name="RadioGroup1" value="two" checked><br> three: <input type="radio" name="RadioGroup1" value="three"><br> </fieldset> </div> </fieldset> </div> <div class="TEdit" id="Edit2" style="position: absolute; top:320px; left: 776px; width: 105px; height: 21px;"><input type="text" name="Edit2"></div> </fieldset> </div> </fieldset> </div> <div align="center" style="margin: auto"><input type="submit" name="submitButton" value="Submit" style="position:absolute;top:522px;"></div> </form> </body> </html>

    Read the article

  • Why isn't my submit button centered?

    - by William
    For some reason my submit button isn't centered. http://prime.programming-designs.com/test_forum/viewboard.php?board=0 #submitbutton{ margin: auto; border: 1px solid #DBFEF8; background-color: #DBFEF8; color: #000000; margin-top: 5px; width: 100px; height: 20px; } here's the html. <form method=post action=add_thread.php?board=<?php echo''.$board.''; ?>> <div id="formdiv"> <div class="fieldtext1">Name</div> <div class="fieldtext1">Trip</div> <input type="text" name=name size=25 /> <input type="text" name=trip size=25 /> <div class="fieldtext2">Comment</div> <textarea name=post rows="4" cols="70"></textarea> <div class="fieldtext2">Fortune</div> <input type="checkbox" name="fortune" value="fortune" /> </div> <input type=submit value="Submit" id="submitbutton"> </form>

    Read the article

  • how to send value to the from action page from database

    - by Mayank swami
    I am creating a faq panel for there can be multiple answers for question and i want to take the answer id .because i am storing comment by answer id the problem is that how to sent the $answer_id to the comment_submit_process.php and how to recognize the answer ? $selected_ques= mysql_prep($_GET['ques']); $query = "SELECT * FROM formanswer where question_id = {$selected_ques}"; $ans= mysql_query($query); if($ans){ while($answer = mysql_fetch_array($ans)) //here is the form <form id="add-comment" action="comment_submit_process.php" > <textarea class="comment-submit-textarea" cols="78" name="comment" style="height: 64px;"></textarea> <input type="submit" name="submitbutton" value="Add Comment" class="comment-submit-button" > <br> <?php $ans_id= $answer['id']; echo $ans_id; ?> <input type="hidden" name="ques" value="<?php echo $_GET['$ans_id'] ?>" /> <span class="counter ">enter at least 15 characters</span> <span class="form-error"></span> </form> <?php }} ?>

    Read the article

  • Focus CSS tag in Internet Explorer 8

    - by Sam
    This is driving me nuts. http://www.cssdrive.com/index.php/examples/exampleitem/focus_pseudo_class This is an example of using the hover pseudo-class. Works fine in Chrome and IE. When I save locally it works fine in Chrome but won't work in IE. What am I doing wrong!? <link rel="Stylesheet" href="style.css" /> <form> <p>1) Name:<br /> <input type="text" size="40"></p> <p>2) Email address:<br /> <input type="text" size="40"></p> <p>3) Comments:<br /> <textarea rows="5" name="comments" cols="45" wrap="virtual"></textarea></p> <p><input id="actualsubmit" type="submit" value="Submit"></p> </form> style.css: input:focus, textarea:focus{ background-color: lightyellow; }

    Read the article

  • How to set HTMLField's widget's height in Admin?

    - by Georgie Porgie
    I have a HTMLField in a model as it's the laziest way to utilize tinymce widget in Admin. But the problem is that the textarea field doesn't have "rows" property set. So the textarea doesn't have enough height comfortable enough for editing in Admin. Is there any way to set the height of HTMLField without defining a ModelAdmin class? Update: I solved the problem by using the following code: def create_mce_formfield(db_field): return db_field.formfield(widget = TinyMCE( attrs = {'cols': 80, 'rows': 30}, mce_attrs = { 'external_link_list_url': reverse('tinymce.views.flatpages_link_list'), 'plugin_preview_pageurl': reverse('tinymce-preview', args= ('tinymce',)), 'plugins': "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", 'theme_advanced_buttons1': "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", 'theme_advanced_buttons2': "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", 'theme_advanced_buttons3': "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", 'theme_advanced_buttons4': "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak", 'theme_advanced_toolbar_location': "top", 'theme_advanced_toolbar_align': "left", 'theme_advanced_statusbar_location': "bottom", 'theme_advanced_resizing': True, 'extended_valid_elements': "iframe[src|title|width|height|allowfullscreen|frameborder|webkitAllowFullScreen|mozallowfullscreen|allowFullScreen]", }, )) class TinyMCEFlatPageAdmin(FlatPageAdmin): def formfield_for_dbfield(self, db_field, **kwargs): if db_field.name == 'content': return create_mce_formfield(db_field) return super(TinyMCEFlatPageAdmin, self).formfield_for_dbfield(db_field, **kwargs)

    Read the article

  • Need help getting Wysihat to work

    - by slythic
    Hi all, I'm using Wysihat in a rails project and am stumped by it's inability to bind to my textarea named post_description (model name Post field name description). I have the following in my head tag: <%= javascript_include_tag 'prototype_1.7'%> <%= javascript_include_tag 'wysihat' %> <script type="text/javascript" charset="utf-8"> document.on("dom:loaded", function() { var editor = WysiHat.Editor.attach('post_description'); var toolbar = new WysiHat.Toolbar(editor); toolbar.addButtonSet(WysiHat.Toolbar.ButtonSets.Basic); // Hide our error message if the editor loads fine $('error').hide(); }); </script> I'm able to see Wysihat works (the bold, italic, and underline tools are shown and when click works as intended). The following in the source of the posts/new HTML: <div id="post_description_editor" class="editor" contenteditable="true"></div> <textarea cols="40" id="post_description" name="post[description]" rows="20" style="display: none; "></textarea> However, when I type something in the description field and click submit the post validation fails saying the description field is empty. Anyone have any clue on how I can get this to work? Thanks in advance!

    Read the article

  • Simple matrix example using C++ template class

    - by skyeagle
    I am trying to write a trivial Matrix class, using C++ templates in an attempt to brush up my C++, and also to explain something to a fellow coder. This is what I have som far: template class<T> class Matrix { public: Matrix(const unsigned int rows, const unsigned int cols); Matrix(const Matrix& m); Matrix& operator=(const Matrix& m); ~Matrix(); unsigned int getNumRows() const; unsigned int getNumCols() const; template <class T> T getCellValue(unsigned int row, unsigned col) const; template <class T> void setCellValue(unsigned int row, unsigned col, T value) const; private: // Note: intentionally NOT using smart pointers here ... T * m_values; }; template<class T> inline T Matrix::getCellValue(unsigned int row, unsigned col) const { } template<class T> inline void Matrix::setCellValue(unsigned int row, unsigned col, T value) { } I'm stuck on the ctor, since I need to allocate a new[] T, it seems like it needs to be a template method - however, I'm not sure I have come accross a templated ctor before. How can I implemnt the ctor?

    Read the article

  • tinymce in ajax call - how to get contents

    - by haries
    this is what I have in my view: <% form_remote_tag :url => { :controller => 'comments', :action => "create", :post_id => "#{@post.id}"}, :html => {:id => 'comment_form' }, :before => "tinyMCE.triggerSave(true,true);" do %> <%= label_tag 'Comment' %><br/> <%= text_area_tag :comment_body, nil,:rows => 10, :cols => 100 %><br/> <p style="margin-top: 10px;"> <%= submit_tag 'Add',:id => 'btnCommentSave' %> </p> <% end %> Tinymce editor is displayed properly. In my controller: how to get the contents of the text area? I am expecting the contents in params[:comment_body] and I am not seeing it? I tried doing this also, $('#btnCommentSave').click( function(){ tinyMCE.triggerSave(true,true); $('#comment_form').submit(); }); What am I missing? Thanks

    Read the article

  • Input questions mysql php html

    - by Marcelo
    (Q1)Hi I'm using textbox in my project and I can't receive the values that are typed <textarea rows="5" cols="60"> Type your suggestion </textarea> <br> <input type="submit" name="sugestao" value="Submit" /> Sorry I don't know how to 'kill' html code, that's why < is missing. All I'm getting in the column of the database from this text box is "Submit", I'd like to receive whatever is written in the text area. How can I make the value equal whaterever is typed? (Q2) How can I make sure that I'll only store the same type(int,varchar,text) that I setted,declared in the database. For example: age(int), but if someone types "abc" in the input it will be stored in my database as the value 0 . How can I forbid this, and only save the age when it's just int and all the other fields(like name, email) are filled ?. And if is still possible warn the user that he is typing something wrong, don't need to say where. Sorry for any mistake in English and Thanks for the attention.

    Read the article

  • Zend_Db Enum Values [Closed]

    - by scopus
    I find this solution $metadata = $result->getTable()->info('metadata'); echo $metadata['Continent']['DATA_TYPE']; Hi, I want to get enum values in Zend_Db. My Code: $select = $this->select(); $result = $select->fetchAll(); print_r($result->getTable()); Output: Example Object ( [_name] => country [query] => Zend_Db_Table_Select Object ( [_info:protected] => Array ( [schema] => [name] => country [cols] => Array ( [0] => Code [1] => Continent ) [primary] => Array ( [1] => Code ) [metadata] => Array ( [Continent] => Array ( [SCHEMA_NAME] => [TABLE_NAME] => country [COLUMN_NAME] => Continent [COLUMN_POSITION] => 3 [DATA_TYPE] => enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') [DEFAULT] => Asia [NULLABLE] => [LENGTH] => [SCALE] => [PRECISION] => [UNSIGNED] => [PRIMARY] => [PRIMARY_POSITION] => [IDENTITY] => ) I see enum values in data_type but i don't get this values. How can get data_type?

    Read the article

  • Submit a form and get a JSON response with jQuery

    - by Leopd
    I expect this is easy, but I'm not finding a simple explanation anywhere of how to do this. I have a standard HTML form like this: <form name="new_post" action="process_form.json" method=POST> <label>Title:</label> <input id="post_title" name="post.title" type="text" /><br/> <label>Name:</label><br/> <input id="post_name" name="post.name" type="text" /><br/> <label>Content:</label><br/> <textarea cols="40" id="post_content" name="post.content" rows="20"></textarea> <input id="new_post_submit" type="submit" value="Create" /> </form> I'd like to have javascript (using jQuery) submit the form to the form's action (process_form.json), and receive a JSON response from the server. Then I'll have a javascript function that runs in response to the JSON response, like function form_success(json) { alert('Your form submission worked'); // process json response } How do I wire up the form submit button to call my form_success method when done? Also it should override the browser's own navigation, since I don't want to leave the page. Or should I move the button out of the form to do that?

    Read the article

  • Ruby on Rails unknown attribute form error

    - by Ulkmun
    I'm attempting to create a form which will allow me to upload a file.. I've got the following form.. <div class="field"> <%= f.label :title %><br /> <%= f.text_field :title %> </div> <div class="field"> <%= f.label :body %><br /> <%= f.text_area :body, "cols" => 100, "rows" => 40 %> </div> <div class="field"> <%= f.label :upload %><br /> <%= f.file_field :upload %> </div> <div class="actions"> <%= f.submit %> </div> I've got a controller which seems to error in this function.. # POST /posts # POST /posts.xml def create @post = Post.new(params[:post]) @post = DataFile.save(params[:upload]) ##render :text => "File has been uploaded successfully" respond_to do |format| if @post.save format.html { redirect_to(@post, :notice => 'Post was successfully created.') } format.xml { render :xml => @post, :status => :created, :location => @post } else format.html { render :action => "new" } format.xml { render :xml => @post.errors, :status => :unprocessable_entity } end end end That's the method that get's called when I create the post. The error is unknown attribute: upload app/controllers/posts_controller.rb:42:in ``new' app/controllers/posts_controller.rb:42:in ``create'

    Read the article

  • Load some data from database and hide it somewhere in a web page

    - by kwokwai
    Hi all, I am trying to load some data (which may be up to a few thousands words) from the database, and store the data somewhere in a html web page for comparing the data input by users. I am thinking to load the data to a Textarea under Div tag and hide the the data: <Div id="reference" style="Display:none;"> <textarea rows="2" cols="20" id="database"> html, htm, php, asp, jsp, aspx, ctp, thtml, xml, xsl... </textarea> </Div> <table border=0 width="100%"> <tr> <td>Username</td> <td> <div id="username"> <input type="text" name="data" id="data"> </div> </td> </tr> </table> <script> $(document).ready(function(){ //comparing the data loaded from database with the user's input if($("#data").val()==$("#database").val()) {alert("error");} }); </script> I am not sure if this is the best way to do it, so could you give me some advice and suggest your methods please.

    Read the article

  • getting string.substring(N) not to choke when N > string.length

    - by aape
    I'm writing some code that takes a report from the mainframe and converts it to a spreadsheet. They can't edit the code on the MF to give me a delimited file, so I'm stuck dealing with it as fixed width. It's working okay now, but I need to get it more stable before I release it for testing. My problem is that in any given line of data, say it could have three columns of numbers, each five chars wide at positions 10, 16, and 22. If on this one particular row, there's no data for the last two cols, it won't be padded with spaces; rather, the length of the string will be only 14. So, I can't just blindly have dim s as string = someStream.readline a = s.substring(10, 5) b = s.substring(16, 5) c = s.substring(22, 5) because it'll choke when it substrings past the length of the string. I know I could test the length of the string before processing each row, and I have automated the filling of some of the vsariables using a counter and a loop, and using the counter*theWidthOfTheGivenVariable to jump around, but this project was a dog to start with (come on! turning a report into a spreadsheet?), but there are many different types of rows (it's not just a grid), and the code's getting ugly fast. I'd like this to be clean, clear, and maintainable for the poor sucker that gets this after me. If it matters, here's my code so far (it's really crufty at the moment). You can see some of my/its idiocy in the processSection#data subs So, I'm wondering 1) is there a way baked in to .NET to have string.substring not error when reading past the end of a string without wrapping it in a try...catch? and 2) would it be appropriate in this situation to write a new string class that inherits from string that has a more friendly substring function in it? ETA: Thanks for all the advice and knowledge everyone. I'll go with the extension. Hopefully one of these years, I'll get my chops up enough to pay someone back in kind. :)

    Read the article

  • Access Question

    - by kralco626
    I have a record set for inspections of many peices of equipment. The four cols of interest are equip_id,month,year,myData. My requirment is to have EXACTLY ONE Record per month for each peice of equipment. I have a quiery that makes the data unique over equip_id,month,year. So there is no more than one record for each month/year for a peice of equipment. But now I need to simulate data for the missing month. I want to simply go back in time to get the last peice of my data. So that may seem confusing, so i'll show by example. Given this: equip_id month year myData 1 1 2010 500 1 2 2010 600 1 5 2010 800 2 2 2010 300 2 4 2010 400 2 6 2010 500 I want this: equip_id month year myData 1 1 2010 500 1 2 2010 600 1 3 2010 600 1 4 2010 600 1 5 2010 800 2 2 2010 300 2 3 2010 300 2 4 2010 400 2 5 2010 400 2 6 2010 500 Notice that im filling in missing data with the data from the month ( or two months etc.) before. Also note that if the first record for equip 2 is in 2/2010 than I don't need a record for 1/2010 even though I have one for equip 1. I just need exactly one record for each month/year for each peice of equipment. So if the record does not exsist I just want to go back in time and grab the data for that record. Thanks!!!

    Read the article

  • Django ModelForm Imagefield Upload

    - by Wei Xu
    I am pretty new to Django and I met a problem in handling image upload using ModelForm. My model is as following: class Project(models.Model): name = models.CharField(max_length=100) description = models.CharField(max_length=2000) startDate = models.DateField(auto_now_add=True) photo = models.ImageField(upload_to="projectimg/", null=True, blank=True) And the modelform is as following: class AddProjectForm(ModelForm): class Meta: model = Project widgets = { 'description': Textarea(attrs={'cols': 80, 'rows': 50}), } fields = ['name', 'description', 'photo'] And the View function is: def addProject(request, template_name): if request.method == 'POST': addprojectform = AddProjectForm(request.POST,request.FILES) print addprojectform if addprojectform.is_valid(): newproject = addprojectform.save(commit=False) print newproject print request.FILES newproject.photo = request.FILES['photo'] newproject.save() print newproject.photo else: addprojectform = AddProjectForm() newProposalNum = projectProposal.objects.filter(solved=False).count() return render(request, template_name, {'addprojectform':addprojectform, 'newProposalNum':newProposalNum}) the template is: <form class="bs-example form-horizontal" method="post" action="">{% csrf_token %} <h2>Project Name</h2><br> {{ addprojectform.name }}<br> <h2>Project Description</h2> {{ addprojectform.description }}<br> <h2>Image Upload</h2><br> {{ addprojectform.photo }}<br> <input type="submit" class="btn btn-success" value="Add Project"> </form> Can anyone help me or could you give an example of image uploading? Thank you!

    Read the article

  • Why won't this work; opencv Mat_<float>

    - by user1371674
    I can't seem to get this to work. I'm trying to get the pixel value of an image but first need to change the color of the image, but since I cannot use int or just Mat because the values are not whole numbers, I have to use and because of that errors pop up when I try to run this on the cmd. int main(int argc, char **argv) { Mat img = imread(argv[1]); ofstream myfile; Mat_<float> MatBlue = img; int rows1 = MatBlue.rows; int cols1 = MatBlue.cols; for(int x = 0; x < cols1; x++) { for(int y = 0; y < rows1; y++) { float val = MatBlue.at<cv::Vec3b>(y, x)[1]; MatBlue.at<cv::Vec3b>(y, x)[0] = val + 1; } } }

    Read the article

  • using Jquery, replace html elements with own values

    - by loviji
    Hello, I have a table, has many rows. for example one of from rows(all rows are same): <tr> <td> <input type="text" /> </td> <td> <textarea cols="40" rows="3" ></textarea> </td> <td> <select> //options </select> </td> <td> <input type="text" /> </td> <td> <input type="checkbox" /> </td> </tr> Rows can be dynamically added by jquery after button click. I'm trying to do: after button click add new row(I do it) and replace previous row Html Elements(input type=text, textarea, select, input type=text, /[input type="checkbox" must be safe]) with its own values. And after if i click on row(anyrow), i want to rollback previous operation. i.e. replace texts with html element. and htmlElement.val()=text. Added after 30 minutes: I wrote for input type=text element and textarea element this. $("#btnAdd").click(function() { $input = $('#mainTable tbody>tr:last').closest("tr").find("td > input:text"); $input.replaceWith($input.val()); $textArea = $('#mainTable tbody>tr:last').closest("tr").find("td > textarea"); $textArea.replaceWith($textArea.val()); }); is this a good idea?

    Read the article

  • How do I select column(s) by their "numeric" position in a table?

    - by DulcimerDude
    I am trying to select columns by their "x" position in the table. DBI my $example = $hookup->prepare(qq{SELECT This,That,Condition,"I also want COLUMN-10" FROM tbl LIMIT ? ?}); ###column_number=10 ordinal_position?? $example->execute('2','10') or die "Did not execute"; Is this possible or do I need to run another single select to just that column? One problem I encountered was with a col named "Condition". For some reason, when I tried to select Condition the execute would die. I never attempted but, What if the column name was SELECT? Another note is the table is 75 cols wide and I only need 50 of them. The Col names are pretty verbose so, I would like to just call them by their "position". This would also allow the col names to be changed in the future without having to change the select statement. I am quite the newbie so please explain any answers down to my level. Thanks for any assistance..

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18  | Next Page >