Multiple "Submit" from User Controls

Results 1 to 2 of 2

Thread: Multiple "Submit" from User Controls

  1. #1
    Join Date
    Dec 1969

    Default Multiple "Submit" from User Controls

    &nbsp;<BR>Here is the situation: My home page has several user controls loaded on it. Each one of these user controls is a small form of sorts. For example, one control is a Login form, another control is a Search form, and yet another lets you sign up for a newsletter. So - each of these controls has some fields to be filled in, and a submit button. <BR><BR>There can only be one server side FORM tag, and the page that is hosting the controls has it. <BR><BR>Now, if the user enters the login info in the login control and clicks submit, it should go to the login page. <BR>If they enter some keywords in the search control and clicks submit, it should go to the search page. <BR>And if the enter their email address in the newsletter control and clicks submit, it should go to the newsletter page. <BR><BR>Does that make sense? <BR><BR>SO... how do I get the FORM to SUBMIT the proper fields to the proper page??? <BR><BR>The only way I have thought of so far is to intercept the click and do a Response.ReDirect in a "GET" style, by manually adding each field: <BR><BR>Respone.Rediect("login.asp?username=" & username.text & "&password=" & password.text") <BR><BR>This is bad for several reasons <BR>* It&#039;s tedious and error prone <BR>* The info is out there for the world to see <BR>* Every time I change fields around, I have to change the string to match <BR>* Etc. <BR><BR>I could also user Session variables, or cookies, but again, this is not the best way to submit a form, especially once forms start getting really complicated (like search forms can). <BR><BR>Am I missing something? Isn&#039;t there a way to make the form submit properly? Can I maybe change the FORM.Action value?

  2. #2
    Join Date
    Dec 1969

    Default RE: Multiple

    You could also try the server.transfer instead of the response.redirect. It would have the same effect without having your variables out there for the world to see. I don&#039;t know of a way to change your form action server side, that would have to run as javascript before the form was submitted, then have javascript actually submit the form. Here is some javascript I used to do something similar across frames...<BR><BR>function cmdSave_onclick() <BR>{ <BR> parent.frames(1).document.forms("frmContent").acti on = "IndexContent.aspx";<BR> parent.frames(1).document.forms("frmContent")("ind exAction").value = "save";<BR> parent.frames(1).ExecuteForm();<BR><BR>}<BR><BR>Th en in my other frame I had the validate/submit function...<BR><BR>function ExecuteForm()<BR> {<BR> if (typeof(Page_ClientValidate) == &#039;function&#039;)<BR> {<BR> if (Page_ClientValidate() == true)<BR> {<BR> document.forms("frmContent").submit();<BR> }<BR> else<BR> {<BR><BR> }<BR> }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts