Search Results

Search found 399 results on 16 pages for 'fieldset'.

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

  • validation using jquery

    - by fusion
    i'm trying to validate an html page using jquery, but nothing happens. it's a simple page, yet the textboxes aren't validated. this is the code: <link rel="stylesheet" type="text/css" href="style.css" /> <script type="text/javascript" src="~/jquery.js/"></script> <script type="text/javascript" src="~/jquery-validate/jquery.validate.js/"></script> <script type="text/javascript"> $(document).ready(function(){ var validator = $("#submitForm").validate({ debug: true, rules: { author: "required", quote: "required" }, messages: { author: "Name of Author required" quote: "Please enter Quote" }, errorPlacement: function(error, element) { error.appendTo( element.parent().top() ); } ); }); </script> <body> <div class="container"> <div class="center_div"> <h2>Submit Your Quote</h2> <fieldset> <form id="submitForm" action="qinsert.php" method="post"> <div class="error" style="display:none"></div> <div class="field"> <label>Author: </label> <input name="author" type="text" class="required" minLength=3> <span class="error"></span> </div><br /> <div class="field"> <label>Quote: </label> <textarea name="quote" cols=22 class="required" minLength=5></textarea> <span class="error"></span> <br /> </div> <input id="button1" type="submit" value="Submit" class="submit" /><br /> <input id="button2" type="reset" value="Reset" /> </form> </fieldset> </div> </div> what is wrong with the code? thank you!

    Read the article

  • ASP.NET MVC null ViewResult

    - by David Neale
    How should one deal with an MVC controller returning a null ViewResult? As an example I am creating a simple edit view: public ActionResult Edit(int id) { var person = (from p in context.SWLiftShare_Persons where p.id == id select p).SingleOrDefault(); if (person != null) { return View(person); } else return View(); } I guess in reality there's no point in checking for a null result in the controller because the view picks out properties from the model: <h2>Edit - <%= Html.Encode(Model.Name) %></h2> <%= Html.ValidationSummary("Edit was unsuccessful. Please correct the errors and try again.") %> <% using (Html.BeginForm()) {%> <fieldset> <legend>Fields</legend> <p> <label for="id">id: <%= Html.Encode(Model.id) %></label> </p> <p> <label for="CollarNumber">CollarNumber:</label> <%= Html.TextBox("CollarNumber", Model.CollarNumber)%> <%= Html.ValidationMessage("CollarNumber", "*") %> </p> <p> <label for="Name">Name:</label> <%= Html.TextBox("Name", Model.Name)%> <%= Html.ValidationMessage("Name", "*") %> </p> <p> <label for="EmailAddress">EmailAddress:</label> <%= Html.TextBox("EmailAddress", Model.EmailAddress, new { style = "width:300px" })%> <%= Html.ValidationMessage("EmailAddress", "*") %> </p> <p> <input type="submit" value="Save" /> </p> </fieldset> <% } %> I could just wrap everything in a <% if(Model != null) { //render edit markup... etc. but that seems rather unelegant. Is there a better way to deal with this?

    Read the article

  • Multiplying field value with retreived value jQuery

    - by Efe
    I pull product price from another page. Then I multiply it with quantity entered in the quantity input field. The problem is, if I forget to enter quantity value before I pull product price data or if I change the quantity field later, the final total price is not updated. I hope I clearly explained it. javascript: $('#AddProduct').click(function() { var i = 0; var adding = $(+(i++)+'<div class="row'+(i)+'"><div class="column width50"><input type="text" id="PRODUCTNAME" name="PRODUCTNAME'+(i)+'" value="" class="width98" /><input type="hidden" class="PRODUCTID" name="PRODUCTID" /><input type="hidden" class="UNITPRICE" name="UNITPRICE'+(i)+'" /><small>Search Products</small></div><div class="column width20"><input type="text" class="UNITQUANTITY" name="UNITQUANTITY'+(i)+'" value="" class="width98" /><small>Quantity</small></div><div class="column width30"><span class="prices">Unit Price:<span class="UNITPRICE"></span><br />Total Price:<span class="TOTALPRICE"></span><br /><a href="#" id="RemoveProduct(".row'+(i)+'");">Remove</a></span></div>'); $('#OrderProducts').append(adding); adding.find("#PRODUCTNAME").autocomplete("orders.cs.asp?Process=ListProducts", { selectFirst: false }).result(function(event, data, formatted) { if (data) { adding.find(".UNITPRICE").html(data[1]); adding.find(".PRODUCTID").val(data[2]); adding.find(".TOTALPRICE").html(data[1] * $('.UNITQUANTITY').val()); } }); return false; }); $('#RemoveProduct').click(function() { $().remove(); return false; }); my html: <fieldset> <h2>Order Items</h2> <div id="OrderProducts"> <a href="#" id="AddProduct"><img src="icons/add.png" alt="Add" /></a> </div> </fieldset> edit Now I totaly messed it up. Removing a row is not working anymore as well... Test link: http://refinethetaste.com/html/cp/?Section=orders&Process=AddOrder#

    Read the article

  • Where i am doing wrong in this?

    - by kumar
    <script type="text/javascript"> $(document).ready(function() { $('#PbtnSubmit').attr('disabled', 'disabled'); $('#PbtnCancel').attr('disabled', 'disabled'); $('#PbtnSelectAll').click(function() { $('#PricingEditExceptions input[type=checkbox]').attr('checked', 'checked'); $('#PbtnSubmit').removeAttr('disabled'); $('#PbtnCancel').removeAttr('disabled'); $('fieldset').find("input,select,textarea").removeAttr('disabled'); }); $('#PbtnCancel').click(function() { $('#PricingEditExceptions input[name=PMchk]').attr('checked', false); $('#PbtnSubmit').attr('disabled', 'disabled'); $('#PbtnCancel').attr('disabled', 'disabled'); $('fieldset').find("input:not(:checkbox),select,textarea").attr('disabled', 'disabled'); $('#genericfieldset').find("input,select,textarea").removeAttr('disabled'); }); $('#PbtnSubmit').click(function() { $('#PricingEditExceptions input[name=PMchk]').each(function() { if ($("#PricingEditExceptions input:checkbox:checked").length > 0) { var checked = $('#PricingEditExceptions input[type=checkbox]:checked'); var PMstrIDs = checked.map(function() { return $(this).val(); }).get().join(','); $('#1_exceptiontypes').attr('value', exceptiontypes) $('#1_PMstrIDs').attr('value', PMstrIDs); } else { alert("Please select atleast one exception"); return false; } }); }); function validate_excpt(formData, jqForm, options) { var form = jqForm[0]; } // post-submit callback function showResponse(responseText, statusText, xhr, $form) { if (responseText[0].substring(0, 16) != "System.Exception") { $('#error-msg-ID span:last').html('<strong>Update successful.</strong>'); } else { $('#error-msg-ID span:last').html('<strong>Update failed.</strong> ' + responseText[0].substring(0, 48)); } $('#error-msg-ID').removeClass('hide'); } $('#exc-').ajaxForm({ target: '#error-msg-ID', beforeSubmit: validate_excpt, success: showResponse, dataType: 'json' }); $('.button').button(); }); </script> This is my button.. at very first when page load I am trying Make Disabled PbtnSubmit and PbtnCancel and when we click PbtnSelectAll I am enabling back again.. but its not doing with this code. is that something I am doing worng in this? thanks

    Read the article

  • jQuery: List expands on page load

    - by Hasanah
    I've been looking for something very simple: How to make a side navigation expand with animation on page load, but all the tutorial websites I usually go to don't seem to have it. The closest I could find is this jQuery sample: http://codeblitz.wordpress.com/2009/04/15/jquery-animated-collapsible-list/ I've managed to strip down the list like so: <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(function(){ $('li') .css('pointer','default') .css('list-style','none'); $('li:has(ul)') .click(function(event){ if (this == event.target) { $(this).css('list-style', (!$(this).children().is(':hidden')) ? 'none' : 'none'); $(this).children().toggle('slow'); } return false; }) .css({cursor:'pointer', 'list-style':'none'}) .children().hide(); $('li:not(:has(ul))').css({cursor:'default', 'list-style':'none'}); }); <body> <fieldset> <legend>Collapsable List Demo</legend> <ul> <li>A - F</li> <li>G - M <ul> <li>George Kent Technology Centre</li> <li>Hampshire Park</li> <li>George Kent Technology Centre</li> <li>Hampshire Park</li> </ul> </li> <li> N - R </li> <li>S - Z</li> </ul> </fieldset> My question is: Is there any way to make this list expand on page load instead of on click? I also don't need it to collapse at all; basically I need only the animating expansion. Thank you for your time and advice. :)

    Read the article

  • ASP.NET MVC Page - Viewstate for Confirm email field is getting erased on Registration Page if valid

    - by Rita
    Hi I have a Registaration page with the following fields Email, Confirm Email, Password and Confrim Password. On Register Button click and post the model to the server, the Model validates and if that Email is already Registered, it displays the Validation Error Message "User already Exists. Please Login or Register with a different email ID". While we are displaying this validation error message, I am loosing the value of "Confirm Email" field. So that the user has to reenter again and I want to avoid this. Here I don't have confirm_Email field in my Model. Is there something special that has to be done to remain Confirm Email value on the Page even in case of Validation failure? Appreciate your responses. Here is my Code: <% using (Html.BeginForm()) {%> <%= Html.ValidationSummary(false) %> <fieldset> <div class="cssform"> <p> <%= Html.LabelFor(model => model.Email)%><em>*</em> <%= Html.TextBoxFor(model => model.Email, new { @class = "required email" })%> <%= Html.ValidationMessageFor(model => model.Email)%> </p> <p> <%= Html.Label("Confirm email")%><em>*</em> <%= Html.TextBox("confirm_email")%> <%= Html.ValidationMessage("confirm_email") %> </p> <p> <%= Html.Label("Password")%><em>*</em> <%= Html.Password("Password", null, new { @class = "required" })%> <%= Html.ValidationMessage("Password")%><br /> (Note: Password should be minimum 6 characters) </p> <p> <%= Html.Label("Confirm Password")%><em>*</em> <%= Html.Password("confirm_password")%> <%= Html.ValidationMessage("confirm_password") %> </p><hr /> <p>Note: Confirmation email will be sent to the email address listed above.</p> </fieldset> <% } %>

    Read the article

  • Included php file calling Javascript function

    - by Illes Peter
    Hi there! Here's the deal. I've got index.php which links to an internal JS file in it's header. index.php then includes another .php file, which outputs this: + add file. addFile() is a Javascript function defined in the external JS file. By doing this nothing happens, the included php does not "see" the JS function. Encapsulating the JS in the included PHP makes it all work. But I don't want to do it that way. Any ideas? EDIT: here's the source <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Archie</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <link rel="stylesheet" href="/screen.css" type="text/css" media="screen"/> <script src="/lib/js/archie.js" type="text/javascript"></script> </head> <body> ... ... //included php starts here <form action="/lib/course.php" method="post"> <fieldset> <div id="addFileLocation"></div> <a href="#" onClick="addFile()">+ add file</a> <input type="hidden" id="addFileCount" value="0"/> </fieldset> </form> //ends here ... ... </body> </html> and the js: <script type="text/javascript"> //Dynamically add form fields //add file browser function addFile() { var location = document.getElementById('addFileLocation'); var num = document.getElementById('addFileCount'); var newnum = (document.getElementById('addFileCount').value -1)+ 2; num.value = newnum; var newname = 'addFile_'+newnum; var newelement = document.createElement('input'); newelement.setAttribute('name',newname); newelement.setAttribute('type','file'); location.appendChild(newelement); } </script>

    Read the article

  • Cannot interact with checkbox in FireFox or Chrome. Works in IE.

    - by Darxide
    Title says it all. Here's the code: <div id="regpage"> <form action="" method="post"> <fieldset style="border:none;"> <div class="label">Username:</div> <input type="text" name="username" class="item" value="" /><br /> <div class="caption">Must be 5-15 characters</div><br /> <div style="clear:both;"></div> <div class="label">Password:</div> <input type="password" name="password" class="item" value="" /><br /> <div class="caption">Must be 6-20 characters</div><br /> <div style="clear:both;"></div> <div class="label">Email:</div> <input type="text" name="email" class="item" value="" /><br /> <div class="caption">Valid email address is required</div><br /> <div style="clear:both;"></div> <input name="terms" type="checkbox" id="terms" value="agree" /><div class="caption2"><label for="terms">I agree to the terms and conditions</label></div> <p><input type="submit" name="register" value="Register" id="register" style="float:left;border:1px solid #999;background:#E4E4E4;margin-top:5px;" /></p><br /> </fieldset> </form> </div> And the id "regpage" is definded in the style.css as: #regpage { width: 356px; height: 150px; color: #000000; font-family: "Tahoma", Arial, Helvetica, sans-serif; font-size: 13px; } If I move the checkbox OUT of it works just fine. But inside it will not interact in Mozilla. I've even tried adding onclick='this.checked="checked"' and it still does not interact. You can click until your blue in the face and nothing will happen. What's the deal! This is REALLY driving me batty.

    Read the article

  • Backbone events not firing (this.el undefined) & general feedback on use of the framework

    - by Leo
    I am very new to backbone.js and I am struggling a little. I figured out a way to get data from the server (in json) onto the screen successfully but am I doing it the right/best way? I know there is something wrong because the only view which contains a valid this.el is the parent view. I suspect that because of this, the events of the view are not firing ()... What is the best way forward? Here is the code: var surveyUrl = "/api/Survey?format=json&callback=?"; $(function () { AnswerOption = Backbone.Model.extend({}); AnswerOptionList = Backbone.Collection.extend({ initialize: function (models, options) { this.bind("add", options.view.render); } }); AnswerOptionView = Backbone.View.extend({ initialize: function () { this.answerOptionList = new AnswerOptionList(null, { view: this }); _.bindAll(this, 'render'); }, events: { "click .answerOptionControl": "updateCheckedState" //does not fire because there is no this.el }, render: function (model) { // Compile the template using underscore var template = _.template($("#questionAnswerOptionTemplate").html(), model.answerOption); $('#answerOptions' + model.answerOption.questionId + '>fieldset').append(template); return this; }, updateCheckedState: function (data) { //never hit... } }); Question = Backbone.Model.extend({}); QuestionList = Backbone.Collection.extend({ initialize: function (models, options) { this.bind("add", options.view.render); } }); QuestionView = Backbone.View.extend({ initialize: function () { this.questionlist = new QuestionList(null, { view: this }); _.bindAll(this, 'render'); }, render: function (model) { // Compile the template using underscore var template = _.template($("#questionTemplate").html(), model.question); $("#questions").append(template); //append answers using AnswerOptionView var view = new AnswerOptionView(); for (var i = 0; i < model.question.answerOptions.length; i++) { var qModel = new AnswerOption(); qModel.answerOption = model.question.answerOptions[i]; qModel.questionChoiceType = ChoiceType(); view.answerOptionList.add(qModel); } $('#questions').trigger('create'); return this; } }); Survey = Backbone.Model.extend({ url: function () { return this.get("id") ? surveyUrl + '/' + this.get("id") : surveyUrl; } }); SurveyList = Backbone.Collection.extend({ model: Survey, url: surveyUrl }); aSurvey = new Survey({ Id: 1 }); SurveyView = Backbone.View.extend({ model: aSurvey, initialize: function () { _.bindAll(this, 'render'); this.model.bind('refresh', this.render); this.model.bind('change', this.render); this.model.view = this; }, // Re-render the contents render: function () { var view = new QuestionView(); //{el:this.el}); for (var i = 0; i < this.model.attributes[0].questions.length; i++) { var qModel = new Question(); qModel.question = this.model.attributes[0].questions[i]; view.questionlist.add(qModel); } } }); window.App = new SurveyView(aSurvey); aSurvey.fetch(); }); -html <body> <div id="questions"></div> <!-- Templates --> <script type="text/template" id="questionAnswerOptionTemplate"> <input name="answerOptionGroup<%= questionId %>" id="answerOptionInput<%= id %>" type="checkbox" class="answerOptionControl"/> <label for="answerOptionInput<%= id %>"><%= text %></label> </script> <script type="text/template" id="questionTemplate"> <div id="question<%=id %>" class="questionWithCurve"> <h1><%= headerText %></h1> <h2><%= subText %></h2> <div data-role="fieldcontain" id="answerOptions<%= id %>" > <fieldset data-role="controlgroup" data-type="vertical"> <legend> </legend> </fieldset> </div> </div> </script> </body> And the JSON from the server: ? ({ "name": "Survey", "questions": [{ "surveyId": 1, "headerText": "Question 1", "subText": "subtext", "type": "Choice", "positionOrder": 1, "answerOptions": [{ "questionId": 1, "text": "Question 1 - Option 1", "positionOrder": 1, "id": 1, "createdOn": "\/Date(1333666034297+0100)\/" }, { "questionId": 1, "text": "Question 1 - Option 2", "positionOrder": 2, "id": 2, "createdOn": "\/Date(1333666034340+0100)\/" }, { "questionId": 1, "text": "Question 1 - Option 3", "positionOrder": 3, "id": 3, "createdOn": "\/Date(1333666034350+0100)\/" }], "questionValidators": [{ "questionId": 1, "value": "3", "type": "MaxAnswers", "id": 1, "createdOn": "\/Date(1333666034267+0100)\/" }, { "questionId": 1, "value": "1", "type": "MinAnswers", "id": 2, "createdOn": "\/Date(1333666034283+0100)\/" }], "id": 1, "createdOn": "\/Date(1333666034257+0100)\/" }, { "surveyId": 1, "headerText": "Question 2", "subText": "subtext", "type": "Choice", "positionOrder": 2, "answerOptions": [{ "questionId": 2, "text": "Question 2 - Option 1", "positionOrder": 1, "id": 4, "createdOn": "\/Date(1333666034427+0100)\/" }, { "questionId": 2, "text": "Question 2 - Option 2", "positionOrder": 2, "id": 5, "createdOn": "\/Date(1333666034440+0100)\/" }, { "questionId": 2, "text": "Question 2 - Option 3", "positionOrder": 3, "id": 6, "createdOn": "\/Date(1333666034447+0100)\/" }], "questionValidators": [{ "questionId": 2, "value": "3", "type": "MaxAnswers", "id": 3, "createdOn": "\/Date(1333666034407+0100)\/" }, { "questionId": 2, "value": "1", "type": "MinAnswers", "id": 4, "createdOn": "\/Date(1333666034417+0100)\/" }], "id": 2, "createdOn": "\/Date(1333666034377+0100)\/" }, { "surveyId": 1, "headerText": "Question 3", "subText": "subtext", "type": "Choice", "positionOrder": 3, "answerOptions": [{ "questionId": 3, "text": "Question 3 - Option 1", "positionOrder": 1, "id": 7, "createdOn": "\/Date(1333666034477+0100)\/" }, { "questionId": 3, "text": "Question 3 - Option 2", "positionOrder": 2, "id": 8, "createdOn": "\/Date(1333666034483+0100)\/" }, { "questionId": 3, "text": "Question 3 - Option 3", "positionOrder": 3, "id": 9, "createdOn": "\/Date(1333666034487+0100)\/" }], "questionValidators": [{ "questionId": 3, "value": "3", "type": "MaxAnswers", "id": 5, "createdOn": "\/Date(1333666034463+0100)\/" }, { "questionId": 3, "value": "1", "type": "MinAnswers", "id": 6, "createdOn": "\/Date(1333666034470+0100)\/" }], "id": 3, "createdOn": "\/Date(1333666034457+0100)\/" }, { "surveyId": 1, "headerText": "Question 4", "subText": "subtext", "type": "Choice", "positionOrder": 4, "answerOptions": [{ "questionId": 4, "text": "Question 4 - Option 1", "positionOrder": 1, "id": 10, "createdOn": "\/Date(1333666034500+0100)\/" }, { "questionId": 4, "text": "Question 4 - Option 2", "positionOrder": 2, "id": 11, "createdOn": "\/Date(1333666034507+0100)\/" }, { "questionId": 4, "text": "Question 4 - Option 3", "positionOrder": 3, "id": 12, "createdOn": "\/Date(1333666034507+0100)\/" }], "questionValidators": [{ "questionId": 4, "value": "3", "type": "MaxAnswers", "id": 7, "createdOn": "\/Date(1333666034493+0100)\/" }, { "questionId": 4, "value": "1", "type": "MinAnswers", "id": 8, "createdOn": "\/Date(1333666034497+0100)\/" }], "id": 4, "createdOn": "\/Date(1333666034490+0100)\/" }], "id": 1, "createdOn": "\/Date(1333666034243+0100)\/" })

    Read the article

  • ASP.NET MVC CRUD PartialView Popup Issue

    - by Smiley Face
    I am creating an MVC website which makes use of Partial Views on Popups to handle all my CRUD transactions. Please note that my application can already handle these CRUD operations perfectly (LINQ-To-Entity). However, I have a problem with my popup forms. Below is the code from my _Add.cshtml: @model MyStore.Models.MyModels.ProductsModel @{ Layout = null; } @using (Ajax.BeginForm("_Add", "Products", new AjaxOptions { InsertionMode = InsertionMode.Replace, HttpMethod = "POST", OnSuccess = "addSuccess" }, new { @id = "addForm" })) { @Html.ValidationSummary(true) <div id="add-message" class="error invisible"></div> <fieldset> <legend>Products</legend> @Html.HiddenFor(m => Model.ProductCode) <div class="editor-label"> @Html.LabelFor(model => model.ProductName) </div> <div class="editor-field"> @Html.EditorFor(model => model.ProductName) @Html.ValidationMessageFor(model => model.ProductName) </div> <div class="editor-label"> @Html.LabelFor(model => model.Price) </div> <div class="editor-field"> @Html.TextBoxFor(model => model.Price) @Html.ValidationMessageFor(model => model.Price) </div> </fieldset> } Below is the code from my Controller: [HttpGet] public ActionResult _Add(string productCode) { ProductsModel model = newProductsModel(); model.ProductCode = ProductCode ; return PartialView(model); } [HttpPost] public JsonResult _Add(ProductsModel model) { if (ModelState.IsValid) { ProductsManager prod = new ProductsManager(); Products pa = new Products(); pa.ProductCode = model.ProductCode; pa.ProductName = model.ProductName; pa.Price = model.Price; prod.AddProduct(pa); return Json(HelperClass.SuccessResponse(pa), JsonRequestBehavior.AllowGet); } else { return Json(HelperClass.ErrorResponse("Please review your form"), JsonRequestBehavior.DenyGet); } } Please note that the _Add.cshtml is a partial view which is being rendered through a Popup.js which I found on the internet. It is rendered through this code: @Html.ActionLink("[Add Product]", "_Add", new { ProductCode = @ViewData["ProductCode"] }, new { @class = "editLink" }) This works okay. I mean it adds product to my database. But my problem is upon clicking the Proceed button, I get this pop-up download dialog from the page: Can somebody please help me with this? I have a hunch it's because of the HttpMethod i'm using (POST, PUT, GET, DELETE) but i'm not really sure which one is right to use or if it really is the problem in the first place. Any help would be greatly appreciated! PS. Sorry for the long post.

    Read the article

  • How can I programmatically add triggers to an ASP.NET UpdatePanel?

    - by scottm
    I am trying to write a quote generator. For each product, there are a set of options. I want to dynamically add a drop down list for each option, and then have their SelectedIndexChanged events all wired up to update the quote cost. I am not having any trouble adding the DropDownList controls to my UpdatePanel, but I can't seem to wire up the events. After the page loads, the drop downs are there, with their data, but changing them does not call the SelectedIndexChanged event handler, nor does the QuoteUpdatePanel update. I have something like this: QuotePanel.ASCX <asp:ScriptManager ID="ScriptManager" runat="server" /> <asp:UpdatePanel ID="QuoteUpdatePanel" runat="server" ChildrenAsTriggers="true"> <ContentTemplate> Cost: <asp:Label ID="QuoteCostLabel" runat="server" /> <fieldset id="standard-options"> <legend>Standard Options</legend> <asp:UpdatePanel ID="StandardOptionsUpdatePanel" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional"> <ContentTemplate> </ContentTemplate> </asp:UpdatePanel> </fieldset> </ContentTemplate> </asp:UpdatePanel> The code to add the dropdowns and the event they are to be wire up for: protected void PopluateUpdatePanel(IQuoteProperty standardOptions) foreach (IQuoteProperty standardOp in standardOptions) { QuotePropertyDropDownList<IQuoteProperty> dropDownList = new QuotePropertyDropDownList<IQuoteProperty>(standardOp); dropDownList.SelectedIndexChanged += new EventHandler(QuotePropertyDropDown_SelectedIndexChanged); dropDownList.ID = standardOp.GetType().Name + "DropDownList"; ScriptManager.RegisterAsyncPostBackControl(dropDownList); Label propertyLabel = new Label() {Text = standardOp.Title, CssClass = "quote-property-label"}; this.StandardOptionsUpdatePanel.ContentTemplateContainer.Controls.Add(propertyLabel); this.StandardOptionsUpdatePanel.ContentTemplateContainer.Controls.Add(dropDownList); _standardOptionsListBoxes.Add(dropDownList); AsyncPostBackTrigger trigger = new AsyncPostBackTrigger() { ControlID = dropDownList.UniqueID, EventName = "SelectedIndexChanged" }; this.StandardOptionsUpdatePanel.Triggers.Add(trigger); } } void QuotePropertyDropDown_SelectedIndexChanged(object sender, EventArgs e) { QuoteCostLabel.Text = QuoteCost.ToString(); }

    Read the article

  • ASP.Net MVC Ajax form with jQuery validation

    - by Tomas Lycken
    I have an MVC view with a form built with the Ajax.BeginForm() helper method, and I'm trying to validate user input with the jQuery Validation plugin. I get the plugin to highlight the inputs with invalid input data, but despite the invalid input the form is posted to the server. How do I stop this, and make sure that the data is only posted when the form validates? My code The form: <fieldset> <legend>leave a message</legend> <% using (Ajax.BeginForm("Post", new AjaxOptions { UpdateTargetId = "GBPostList", InsertionMode = InsertionMode.InsertBefore, OnSuccess = "getGbPostSuccess", OnFailure = "showFaliure" })) { %> <div class="column" style="width: 230px;"> <p> <label for="Post.Header"> Rubrik</label> <%= Html.TextBox("Post.Header", null, new { @style = "width: 200px;", @class="text required" }) %></p> <p> <label for="Post.Post"> Meddelande</label> <%= Html.TextArea("Post.Post", new { @style = "width: 230px; height: 120px;" }) %></p> </div> <p> <input type="submit" value="OK!" /></p> </fieldset> The JavaScript validation: $(document).ready(function() { // for highlight var elements = $("input[type!='submit'], textarea, select"); elements.focus(function() { $(this).parents('p').addClass('highlight'); }); elements.blur(function() { $(this).parents('p').removeClass('highlight'); }); // for validation $("form").validate(); }); EDIT: As I was getting downvotes for publishing follow-up problems and their solutions in answers, here is also the working validate method... function ajaxValidate() { return $('form').validate({ rules: { "Post.Header": { required: true }, "Post.Post": { required: true, minlength: 3 } }, messages: { "Post.Header": "Please enter a header", "Post.Post": { required: "Please enter a message", minlength: "Your message must be 3 characters long" } } }).form(); }

    Read the article

  • displaying data from database in to text box

    - by srinayak
    I have 2 JSP pages as below: projectcategory.jsp <% Connection con = DbConnect.connect(); Statement s = con.createStatement(); ResultSet rs = s.executeQuery("select * from projectcategory"); %> <DIV class="TabbedPanelsContent" align="center"> <TABLE border="1"> <TR> <TH>CATEGORY ID</TH> <TH>CATEGORY NAME</TH> <TH>Edit/Update</TH> </TR> <% while (rs.next()) { %> <%String p=rs.getString(1);%> <TR> <TD><%=rs.getString(1)%></TD> <TD><%=rs.getString(2)%></TD> <TD> <FORM action="EditPcat.jsp?pcatid=p"><INPUT type="submit" value='edit/update'></INPUT> </FORM> </TD> </TR> <% } %> </TABLE> </DIV> another is Editpcat.jsp: </head> <body> <%String s=request.getParameter("p"); %> <form action="ProjCatServlet" method="post"> <div align="right"><a href="projectcategory.jsp">view</a></div> <fieldset> <legend>Edit category</legend> <table cellspacing="2" cellpadding="2" border="0"> <tr> <td align="left">Category Id</td> <td><input type="text" name="pcatid" value="<%=s%>" ></td> </tr> <tr> <td align="right">Category Name</td> <td><input type="text" name="pcatname"></td> </tr> <tr> <td><input type="submit" value="submit"></td> </tr> </table> <input type="hidden" name="FUNCTION_ID" value="UPDATE"> </fieldset> </form> How to display value from one JSP page which we get from database in to text box of another JSP?

    Read the article

  • jquery validation plugin doesn't seem to work ....

    - by Pandiya Chendur
    asp.net mvc's Html.BeginForm() seems to work with jquery validation plugin but the validation plugin doesn't seem to work with a form which i ve added to a page.... This works, <% using (Html.BeginForm("Login", "Registration", FormMethod.Post, new { id = "Loginform" })) {%> <fieldset> <legend>Login</legend> <p> <label for="EmailId">EmailId:</label> <%= Html.TextBox("EmailId", null, new { @class = "text_box_height_14_width_150" })%> </p> <div class="status"></div> <p> <label for="Password">Password:</label> <%= Html.Password("Password",null, new { @class = "text_box_height_14_width_150" }) %> </p> <div class="status"></div> <p> <input type="submit" value="Login" id="login" /> </p> </fieldset> <% } %> But this doesn't work, <form id="Loginform" method="post" action="Registration/Login"> <table cellpadding="0" cellspacing="0" width="100%" style="border:none;"> <tr> <td width="12%">Email Id&nbsp;:&nbsp;</td><td width="15%"> <input id="EmailId" type="text" class="text_box_height_14_width_150 name="EmailId" /></td><td width="20%" class="status"></td> <td width="12%">Password&nbsp;:&nbsp;<td width="15%"><input id="Password" type="password" class="text_box_height_14_width_150 name="Password" /></td> <td width="20%" class="status"></td> <td width="5%"><input type="submit" value="Login" id="BtnLogin" /></td> </tr> </table> </form> and my jquery function has this, $(document).ready(function() { var validator = $("#Loginform").validate({ rules: { EmailId: "required", Password: { required: true, minlength: 6 } }, messages: { EmailId: "Enter your EMail ID", Password: { required: "Please Provide a password", rangelength: jQuery.format("Enter at least {0} characters") } }, // the errorPlacement has to take the table layout into account errorPlacement: function(error, element) { error.appendTo(element.parent().next()); }, // set this class to error-labels to indicate valid fields success: function(label) { // set &nbsp; as text for IE label.html("&nbsp;").addClass("checked"); } }); }); Any suggestion... Am i missing something?

    Read the article

  • ServeletException, Property <variable name> not found

    - by k9yosh
    What i'm trying to do is add a new variable to this previously created Managed Bean Hello.java and use it in my xhtml file binding to a text field. But it seems that it is not being found when i run it on the server. So it throws a "ServeletException" and says that the "property 'lname'(my variable) is not found". How do i solve this and why is this happening? This is my managed bean, package stack.tute.malinda.model; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; @ManagedBean @RequestScoped public class Hello { private String fname; private String message; private String lname; //trying to add this new variable and use it in my xhtml file in a text field. public String getLname() { return lname; } public void setLname(String lname) { this.lname = lname; } public String getName() { return fname; } public String createMessage() { message="Hello " + fname + ""+ lname +"!"; return null; } public void setName(String fname) { this.fname=fname; } public String getMessage() { return message; } } This is my xhtml code, <h:body> <fieldset style="padding: 1em; float:left; margin-right:0.5em; padding-top:0.2em; text-align:left; border:1px solid green; font-weight:bold;"> <legend>Personal Details</legend> <h:form> <h:outputLabel for="name" value="First Name :" required="true"/> <h:inputText id="name" value="#{hello.name}"/> <br/> //Trying to access that variable here. <h:outputLabel for="name1" value="Last Name :" required="true"/> <h:inputText id="name1" value="#{hello.lname}"/> <h:message for="name"/> <br/> <h:commandButton value="Say hello" action="#{hello.createMessage}"> <f:ajax execute="@form" render="@form"/> </h:commandButton> <br/> <h:outputText value="#{hello.message}"/> </h:form> </fieldset>

    Read the article

  • assign a model's attribute through association

    - by justcode
    I'm new to rails and working on a rails app and I'm stuck pondering this issue. I have three models class product < ActiveRecord::Base attr_accessible :name, :issn, :category validates_presence_of :name, :issn, :category validates_numericality_of :issn, :message => "has to be a number" has_many :user_products has_many :users, :through => :user_products end class UserProduct < ActiveRecord::Base attr_accessible :price, :category validates_presence_of :price, :category validates_numericality_of :price, :message = "has to be a number" belongs_to :user belongs_to :product end class user < ActiveRecord::Base # devise authentication here # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me has_many :user_products has_many :products, :through = :user_products end here is my new.html.erb <div class="MainBodyWrapper"> <div class="span8"> <div id="listBoxWrapper"> <fieldset> <%= form_for(@product, :html => { :class => "form-inline" }, :style => "margin-bottom: 60px" ) do |f| %> <div class="control-group"> <label class="control-label" for="name">name</label> <div class="controls"> <%= f.text_field :price, :class => 'input-xlarge input-name', :id => "name" %> </div> </div> <div class="listingButtons"> <button class="btn btn-info"></i>Add</button> <a class="btn">Upload Pictures (anytime)</a> </div> </fieldset> </div> </div> There are reasons why I want to setup the models this way. So the question is this: I want the user to enter the info for the product in the form but it also involves putting in the price of the product which exists in a different model/table (user_product) that is associated with product. How can I do this? You can see that my form_for uses @product. Any help will be appreciated.

    Read the article

  • Validate dependent model validation and show error message.

    - by piemesons
    Just taking a simple example. We have a question on stackoverflow and while posting a question we want to validate title_of_question, description_of_question that they should be present. Now we have a another model tag having habtm relationshio with question model. How to validate that while saving the question. Means question must have some tags. here the code:-- Models:-- class Question < ActiveRecord::Base belongs_to :user has_and_belongs_to_many :tags has_many :comments, :as => :commentable has_many :answers, :dependent => :destroy validates_presence_of :title, :content, :user_id end class Tag < ActiveRecord::Base has_and_belongs_to_many :questions validates_presence_of :tag end Form for entering question and tag <div class="form"> <% form_for :question ,@question, :url => {:action => "create" } do |f| %> <fieldset> <%= f.error_messages %> <legend>Post a question</legend> <div> <%= f.label :title %>: <%= f.text_field :title, :size => 100 %> </div> <div> <%= f.label :content ,'Question' %>: <%= f.text_area :content, :rows => 10, :cols => 100 %> </div> <div> <%= label_tag 'tags' %>: <%= text_field_tag 'tag' ,'',:size=> 60 %> add multiple tag using comma </div> <div> <%= submit_tag "Post question" %> </div> </fieldset> <% end %> </div> From Controller.. (Right now question will be saved without validating tag) def create @question = Question.new(params[:question]) @question.user_id=session[:user_id] if @question.save flash[:notice] = "Question has been posted." redirect_to question_index_path else render :action => "new" end end questions_tags table has been created. One approach is creating a virtual column using attribute accessors. another approach is validate associated. right now assuming new tags can be created.(but not duplicate).

    Read the article

  • CKEdtior not displaying

    - by user1708468
    I am trying to integrate CKEditor into a MVC application. As far as I can tell all I should really have to do is. Add the following to my master page. <script type="text/javascript" src="../../ckeditor/ckeditor.js"></script> <script type="text/javascript" src="../../ckeditor/adapters/jquery.js"></script> <script type="text/jscript" src="../../Scripts/jquery-1.3.2.js"></script> Then on my view itself. I have the following code: <script type="text/javascript"> $(document).ready(function() { $('#news').ckeditor(); }); </script> <fieldset> <legend>Fields</legend> <p> <label for="title">Title:</label> <%=Html.TextBox("title")%> <%= Html.ValidationMessage("title", "*") %> </p> <p> <label for="news">News:</label> <%=Html.TextArea("news")%> <%= Html.ValidationMessage("news", "*") %> </p> <p> <label for="publishedDate">Publication Date:</label> <%= Html.TextBox("publishedDate") %> <%= Html.ValidationMessage("publishedDate", "*") %> </p> <p> <input type="submit" value="Create" /> </p> </fieldset> Please bear in mind I am not trying to get this to actually DO anything postback wise. Just to actually render in the first place. Can someone point out exactly what it is I am doing wrong? Oh and if it helps any VS is also giving me the following warning: Warning 1 Error updating JScript IntelliSense: ..Cut to Protect the innocent..\ckeditor\ckeditor.js: 'getFirst()' is null or not an object @ 15:180 ..Cut to Protect the innocent..\Views\Shared\Admin.Master 1 1 ilaTraining

    Read the article

  • exclude private property from print_r or object?

    - by Hailwood
    Basically I am using Code Igniter, and the Code Igniter base class is huge, when I print_r some of my objects they have the base class embedded inside them. this makes it a pain to get the information I actually wanted (the rest of the properties). So, I am wondering if there is a way I can hide, or remove the base class object? I have tried clone $object; unset($object->ci); print_r($object); but of course the ci property is private. the actual function I am using for dumping is: /** * Outputs the given variables with formatting and location. Huge props * out to Phil Sturgeon for this one (http://philsturgeon.co.uk/blog/2010/09/power-dump-php-applications). * To use, pass in any number of variables as arguments. * Optional pass in "true" as final argument to kill script after dump * * @return void */ function dump() { list($callee) = debug_backtrace(); $arguments = func_get_args(); $total_arguments = count($arguments); if (end($arguments) === true) $total_arguments--; echo '<fieldset style="background: #fefefe !important; border:2px red solid; padding:5px">'; echo '<legend style="background:lightgrey; padding:5px;">' . $callee['file'] . ' @ line: ' . $callee['line'] . '</legend><pre>'; $i = 0; foreach ($arguments as $argument) { //if the last argument is true we don't want to display it. if ($i == ($total_arguments) && $argument === true) break; echo '<br/><strong>Debug #' . (++$i) . ' of ' . $total_arguments . '</strong>: '; if ((is_array($argument) || is_object($argument)) && count($argument)) { print_r($argument); } else { var_dump($argument); } } echo '</pre>' . PHP_EOL; echo '</fieldset>' . PHP_EOL; //if the very last argument is "true" then die if (end($arguments) === true) die('Killing Script'); }

    Read the article

  • Retrieving the Selected value dynamically in JQuery

    - by Chakradhar
    i have this html, this is generated dynamically based on question number <fieldset id="selectfield"> <label class="select">What ur is Profession? </label> <br> <div class="ui-select"><a href="#" role="button" id="72+_select-button" aria-haspopup="true" aria-owns="72+_select-menu" data-theme="c" class="ui-btn ui-btn-icon-right ui-btn-corner-all ui-shadow ui-btn-hover-c ui-btn-up-c"><span class="ui-btn-inner ui-btn-corner-all" aria-hidden="true"><span class="ui-btn-text">Business</span><span class="ui-icon ui-icon-arrow-d ui-icon-shadow"></span></span></a> <select name="selectedObjects" id="72+_select" data-native-menu="false" tabindex="-1"> <option value="-1">--Select--</option> <option value="769">Salaried</option> <option selected="selected" value="770">Business</option> <option value="771">Self Emp</option> </select></div> </fieldset> click button is <div data-theme="c" class="ui-btn ui-btn-corner-all ui-shadow ui-btn-hover-c ui-btn-up-c" aria-disabled="false"><span class="ui-btn-inner ui-btn-corner-all" aria-hidden="true"><span class="ui-btn-text">Next</span></span> <input type="submit" id="72+_b" onclick="return SaveDropDown(this);" value="Next" class="ui-btn-hidden" aria-disabled="false"> </div> i have written this JS in SaveDropDown(this) function SaveDropDown(button) { var fieldsetName = getQuestionName(button.id)+'+_select'; var select = $(fieldsetName +"option:selected").val(); return false; } the questionname function is function getQuestionName(buttonid) { var splitstr = buttonid.split('+'); var fieldsetName = '#' + splitstr[0]; return fieldsetName; } but its returning the undefined how do i retrieve the select value dynamically. any help is appreciated.

    Read the article

  • Why does this vertical-align:middle fails in Jquery mobile

    - by SJ GJ
    Am trying to middle a set of icons to the middle of screen, below is the code: <div data-role="content" class="ui-content ui-body-a" style="vertical-align: middle" data-theme="a"> <fieldset class="ui-grid-a icon-set" style="vertical-align: middle" data-theme="b"> <div class="ui-block-a center" style="vertical-align: middle"> <a href="test"> <div> <img src="css/images/test5.png" style="width: 80px;height: 80px"/> </div> <div> Login </div> </a> </div> <div class="ui-block-b center"> <a href="#settings" data-transition='slide'> <div> <img src="css/images/test4.png" style="width: 80px;height: 80px"/></div> <div>Settings</div> </a> </div> <div class="ui-block-a center"> <a href="test"> <div> <img src="css/images/test2.png" style="width: 80px;height: 80px"/></div> <div>Aboutus</div> </a> </div> <div class="ui-block-b center"> <a href="test"> <div> <img src="css/images/test1.png" style="width: 80px;height: 80px"/></div> <div>Contact Us</div> </a> </div> </fieldset> </div>

    Read the article

  • How do I call a Asp.Net textbox in CSS?

    - by mw
    I hope this isn't too difficult, obviously you can call HTML tags such as fieldset, label and legends and also textboxes. However how does one call an asp:textbox, i have tried just textbox, asp:textbox, input.textbox but nothing seems to work. This is something that should be really straight forward to do and I can't waste any more time figuring it out. Thanks.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16  | Next Page >