.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

validate and hidden fields

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :ASP.Net
Here is my dilemma, I have a web page that I hides and shows textboxes based off a selection within a dropdown. The dropdown shows Yes/No, if they select NO they see one set of textboxes to fill out, if they select YES they see a different set of textboxes, once they're done, they click submit which does validation. Here is my issue. ALL textboxes are required, so how can I not validate the textboxes that are not showing on the screen? I'm hiding them like this: var show=""; function show(o) { if (show != "") show.style.display = 'none'; if(o.selectedIndex>0) { var d=document.getElementById(o[o.selectedIndex].value); d.style.display='block'; show = d; } } and I call that from my dropdown. onchange="show(this);">   and I have this in my HTML <tbody id="N1" style="display: none;"> </tbody> and I have textboxes within the N1 tag, I also have an N2 tag that shows if YES is selected.each tag has required textboxes, how can I not validate the textboxes if they are not showing on the screen and are in the hidden N tag?  

View Complete Post

More Related Resource Links

How to make Hidden Fields appear on every other page when there are other data regions exist on the

Dev Environment: Visual Studio 2008 Client reporting(.rdlc) I have a client report with one hidden field and one table. The data for the hidden field come from one dataset and the data for the table comes from another dataset. Since there is huge data on the report, the table data spans multiple pages. at the same time i want the hidden field to appear on every other page along with table. i'm using these hidden for report header purposes. As an alternative i have used hidden parameters instead of Hidden Fields. Are there any alternatives other than this ? -- Praveen

hidden fields


we have a web application developed with .net 2.0 framework. The home page is instrumented with master page. I see an hidden control name as "__LASTFOCUS" in the view source of the home page. I dont know how it is getting generated. I never declared it in aspx/cs page as well.  I looked at the entire solution but i couldn't find explicit declaration of the field. Any idea how to track that field? 

Sharepoint designer 2007 - Java date query - and how to disable value required for hidden fields


Hi guys,

created a list, i've managed to get field to hide and dates to populate into the applicable fields, I just have 2 queries taht I need some help with

>I need to work out how to get var tmoz to ignore saturdays and sundays - i.e. if request is raised on fri - it would default to the following mondays

>I need to work out how to mark a field as no input required if it is hidden, and input required if visible (urgent change justifacation)

 Below is the current java i'm using

<script type="text/javascript">
  function hideFieldsOnStart()
   //hide the control at start
   var control = getTagFromIdentifierAndTitle("input","TextField","Urgent Change Justifacation");
   var control2 = getTagFromIdentifierAndTitle("input","DateTimeFieldDate","Proposed Implementation Date");
   //add an onchange event to the dropdown
   getTagFromIdentifierAndTitle("select","DropDownChoice","Change Type").onchange = function() {ChangeEvent()};

webpart to open link and prepend hidden htlm fields to hosted payment site


I have an almost completed application based on SharePoint 2010 and InfoPath 2010 forms. I think what is now needed is a custom webpart that will bring in 3 web part connection parameter fields from the forms in SharePoint, open a link to an HTML site, and prepend some static and dynamic HTML to the stream and open a new window that will allow a user to enter credit card data into the https site thus opened. Next is to write back the results of the transaction to a form column paid_in_full yes/no, that I in turn can release the goods to the user.

Any suggestions as to how to accomplish this in a web part or other is greatly appreciated!



Validate Fields in InfoPath form 2010 before submit


I have designed a InfoPath form with some fields and a Submit Button which has got

Submit Action,

when the Submit button is clicked before it gets submitted to sharepoint list, i want ot validate all the fields

how could i do this

or should i use rules,

but using rules can i submit data to sharepoint list(if possible how)


How to get rid of hidden fields in ASP.net MVC 2



My problem is that, I have a strongly typed view and to retain some model values. I am using hidden control in my View. But due to security purpose, I don't want hidden fields on my View.If I will not use them then on Post action I am not getting the value of model property in my controller.

Please help!Cry



JQuery Validate plugin to validate a ASP.NET Form

The first time I used the JQuery Validate plugin, it did not work at all, see JQuery Validate odd behaviour with the ASP.NET Script Manager for reason, but perseverance and stubbornness prevailed and I finally created my first JQuery validated ASP.NET Forms contact form.

Tab container rendered with visibility:hidden - This was reported over three years ago.



Here is (more) code that demonstrates the issue.  If the control in the host page is removed the tab control renders correctly.  Otherwise it is rendered with the visibility attrubute set to hidden as reported in the above link.  Is this broken or am I doing something wrong?



<%@ Page Language="C#" AutoEventWireup="true" CodeFile="S2.aspx.cs" Inherits="S2" %>
<%@ Register Src="~/SelectorPatternControl.ascx" TagName="TestControl" TagPrefix="sam" %>
<!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">
<head runat="server">
    <form id="form1" runat="server">
        <cc1:ToolkitScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"></cc1:ToolkitScriptManager>

Hidden variable has no value


I know I have a valid solution, but the js is telling me that the value in the hdnRecordSaved variable has no value!
Even when I specify in my function the following, it still tells me it has no value:
var myTextField = document.getElementById('hdnRecordSaved');

When I put the full value of the variable in (ctl00_ctl00_cphTopCenter_cphCenter_hdnRecordSaved.value), I get the correct contents back ("1"), which I set in my code behind. However, I would prefer to just put the short name in since the masterpages may change, etc. Unfortunately, I know I can get around this with VS2010, but we are using VS2008.

What am I doing wrong with the js naming conventions that can't give me the contents? Here is my below js.

<asp:Panel ID="pnlMapFields" runat="server" ScrollBars="Both" Height="430px">

<telerik:RadTreeView ID="RadTreeView1" runat="server" DataTextField="Description"

DataFieldParentID="MapFieldparentID" DataF

Create ID (uniqueid?) from two fields when data is entered


I need to create an ID from two fields when they are entered into the db for the first time.  I thought Uniqueidentifer would do this, but it looks like uniqueidentifier is random and i have no control of the process. 

My user will enter 4 letters into a column called INIT and 4 numbers into a column called NUMB.  What I would like to do is create an id by combining those fields.

How can I do this?



LINQ with GridView and edit fields


My project includes a grid view which displays information of inventory items (Assets), data is quried from AssetTable. The GridView has a command field to allow editing, below is a description of the tables and how data is displayed


BuildingTable: (BuildingID, BuildingName)

AssetTable: (BuildingID,..,....,....)


ItemTemplate: Using a LINQ query I join the two table and displays in a label control a string which includes BuildingID and BuildingName (5 North Building)

 EditItemTemplate: Using a LINQ query I populate a DropDownList with strings of BuildingID and BuildingName same as above.
Here  issue which I need to resolve:
1.  ItemTemplate display the correct information (BuildingID BuildingName) but when I switch to EditItemTemplate the pair that is 
displayed is the first one on the list, how do I make is scroll to the item which was displayed in the label ?
<asp:CommandField ShowEditButton="True" >
                    <ControlStyle Wi

I want Er Diagram for Fees System of small institution ,can u plz guide me what fields are necessary


I want Er Diagram for Fees System of small institution ,can u plz guide me what fields are necessary to store Fees information ...


Validate form input - Japanese


 I've searched for several hours and haven't come up with a reference - or even many discussions - of how to go about validating Japanese names, addresses, etc. When I lived in Japan websites, atm's etc. required such info to be entered with the roman alphabet but I've seen some websites that are allowing Kanji/Hiragana/Katakana. I haven't tested many of them for validation but one that I did test (after looking at the page source and discovering no client-side validation) allowed me to put this in the name field: J*=123*go^ Neat!

Any pointers/references? Thanks

SQL Server: Uncover Hidden Data to Optimize Application Performance


SQL Server 2005 gathers a lot of useful data that you can use to identify areas where database performance can be improved. Here's what you need to improve performance.

Ian Stirk

MSDN Magazine January 2008

Cutting Edge: Custom Data Control Fields


In ASP. NET 2. 0, the GridView and DetailsView controls are designed to work together. They don't merely provide complementary services, they also share a number of helper classes and components. The output of the GridView control consists of a sequence of rows, each with a fixed number of columns.

Dino Esposito

MSDN Magazine January 2006

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend