Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Are there reliable alternatives to the classic submit button?

Status
Not open for further replies.

cesark

Programmer
Joined
Dec 20, 2003
Messages
621
I have three form pages process registration, in order to submit every form I use 'asp: button', as well these buttons triggers subroutines, and through the 'OnSubmit' html form event several javascript validations are triggered:
Code:
<form id='form1' OnSubmit='client_Validation()' runat='server'>
My question is, Can I use 'asp:linkbutton' or 'asp:imagebutton' in order to do the same things? I mean, trigger the subroutines and to cause the form submit so that the javascript validations works? Have the 'asp:button', 'asp:linkbutton' and 'asp:imagebutton' the same utilities? Will I encounter problems with the old browser client versions?

I would like to use links, images and so on instead of the classic gray buttons, but I was told that if I use links, images,.. I don' t have the guarantee that all the browser versions will work correctly in order to trigger the javascript validations through the 'OnSubmit' html event. Is this true?

Thank you,
Cesar
 
Well, I am a little bit confused in this subject, I think the linkbutton can have problems if the JavaScript is disabled on the browser, if this happens, server side form validation will not be able to work, and no postback will be triggered, so, a big disaster.. Unless you use CausesValidation=true or call Page.Validate(). Instead, if you use an ‘asp:button’ (<input type="submit"...>) or an ‘asp:imagebutton’ (<input type="image"...>), the page will do the postback always, so server validations will work, as well if the JavaScript is not disabled form the browser, you will able to call JavaScript form validation through the ‘OnSubmit’ html event, without adding nothing else to the code.

So, if I am not wrong, the simply and easy way to submit forms is with ‘asp:button’ or ‘asp:imagebutton’, nothing else.

Any suggestions?

Cesar
 
Yes, I think you are correct, Cesar - if Javascript is disabled postback can only be done with the asp:button or the asp:imagebutton. Client side validation will not happen either, but the way I understand it the validation WILL occur on the server in that case. Since the linkbutton uses javascript to postback, it won't work at all (no postback).

So, the only big dissaster is if they have no javascript then they can't post any data using linkbuttons.

Have you had users complain that they can't use your app because they have javascript turned off?






Greetings,
Dragonwell
 
Have you had users complain that they can't use your app because they have javascript turned off?

Not until now, I' m only trying to apply the best solution. Indeed I suppose it is very strange that users have javascript turned off, but I am always asking myself why the majority of websites (ASP.NET app included) uses the classic gray button (asp:button) in web forms in order to submit the data, instead of using beautiful images or links. Maybe they are using classic gray buttons to avoid confusing the user with other ways of submit the forms, and/or to avoid the technical disadvantages of links and images... this is my main doubt :-).

Cesar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top