Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Validation error when using masterpage

Featured Replies

When using the w3c validation tool I'm getting an error telling me that I "can't use input here"

 

I know it refers to not being allowed to use the tag directly inside a form, but if you look at my source code: http://siegemachine.net you'll see the input is automatically nested in div tags by asp. What's the problem?

 

Cheers

It's probably the first backslashe in the input value fields, HTML is trying to interpret those as element closing tags.

 

The solution is not to use values with backslash as the first characte, or try a less strict Doctype.

Edited by BlueDreamer

  • Author

The problem is I can't change the input lines, they get automatically created by the server. It's not a big deal I suppose, but I'm creating this as part of an assignment for my degree and want valid markup. I could change the doctype but I decided on strict to force myself to meet a high standard, as I've not really made a decent website before.

  • Author

For anyone who is interested, this code solves the problem by removing the fields

 

    
protected override void Render(HtmlTextWriter output)
   {
       // instance of string builder
       System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
       // instance of string writer
       System.IO.StringWriter stringWriter = new System.IO.StringWriter(stringBuilder);
       // to write the new html...
       HtmlTextWriter htmlWriter = new HtmlTextWriter(stringWriter);
       // loop through each control in this document
       foreach (Control ctrl in this.Controls)
       ctrl.RenderControl(htmlWriter);
       String html = stringBuilder.Replace("/>", "/>").ToString();
       // find those pesky hidden fields
       int intViewStart = html.IndexOf("<input type=\"hidden\" name=\"__VIEWSTATE\"");
       // find the end of the hidden field
       int intViewFinish = html.IndexOf(">", intViewStart) + 1;
       // pinpoint where they fields are and cut them out
       string strViewTag = html.Substring(intViewStart, intViewFinish - intViewStart);
       System.Diagnostics.Debug.WriteLine(strViewTag);
       html = html.Replace(strViewTag, "");
       // write new string to file
       output.Write(html);
   }
}

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.