Results 1 to 14 of 14

Thread: Textbox and querystring

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2004
    Posts
    182

    Textbox and querystring

    Is this a valid tag? I want to put the value of a querystring in my text box.

    <td>&nbsp;&nbsp;<input id="txtcap" style="FONT-SIZE: xx-small" maxLength="5" size="13" name="txtcap" value=<%=Request.QueryString("txtcap")%>></td>

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: Textbox and querystring

    Originally posted by realgoldn
    Is this a valid tag? I want to put the value of a querystring in my text box.

    <td>&nbsp;&nbsp;<input id="txtcap" style="FONT-SIZE: xx-small" maxLength="5" size="13" name="txtcap" value=<%=Request.QueryString("txtcap")%>></td>
    Yes its valid.

    For better result wrap it up with quote or you will have problem if you have input shuch as single quote or double quote.

    Code:
    <td>&nbsp;&nbsp;<input id="txtcap"  style="FONT-SIZE: xx-small" maxLength="5" size="13" name="txtcap" value="<%=Request.QueryString("txtcap")%>"></td> [/B][/QUOTE]
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2004
    Posts
    182
    My text box is blank but I know there is a value for the Request.QueryString("txtcap"). I tested it by saying
    <%
    l=Request.QueryString("txtcap").
    %>
    And there is a value in L but when I but it has the value in my text box its blank.
    Is there another way I should be doing this?


  4. #4
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by realgoldn
    My text box is blank but I know there is a value for the Request.QueryString("txtcap"). I tested it by saying
    <%
    l=Request.QueryString("txtcap").
    %>
    And there is a value in L but when I but it has the value in my text box its blank.
    Is there another way I should be doing this?

    How are you passing the value, using Get or Post Method?
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2004
    Posts
    182
    get

  6. #6
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by realgoldn
    get
    Is the Value for txtcap showing up in the address box?
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Mar 2004
    Posts
    182
    Hmm, No it isn't. Maybe I am doing something wrong. I have a form with text boxes on it. If a user wants to add a new category on the form they click the category link which brings up a popup box. The user fills ouf the popbox then clicks submit the submit button submits the form then closes the popup box. So when the popup box closes I want the value they added on the popup form to be displayed on the main form. Hope this makes sense.

  8. #8
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Are you sure you have put the text box inside the form? Could be you are doing something wrong.

    Let me deal with one question at a time. Post your html code for the textbox and how you reading the value.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Mar 2004
    Posts
    182
    Thanks. I have attached the popupform and the main form.
    Attached Files Attached Files

  10. #10
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by realgoldn
    Thanks. I have attached the popupform and the main form.
    Why rtf? Thats too much code, i am too lazy to go through them, can you tell me where the problem is and i will try to solve it.

    Also i cant test it coz of all the DB stuff.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Mar 2004
    Posts
    182
    Sorry. I hope this is enought to help me out.

    The popup form is like this

    <FORM NAME="AddCAP" ACTION="addproj.asp" METHOD=get>
    </TD>&nbsp; Cap #<INPUT id=txtcap
    style="LEFT: 124px; WIDTH: 145px; TOP: 16px; HEIGHT: 21px" size=18
    name=txtCAP readonly></P>
    <P><INPUT onclick=VBScript:ValidateAddForm type=button value="Add Project" name=AddButton></P>
    <form>

    ValidateAddform()

    if add.txtcap.value="" then
    msgbox "Please select a valid division and type.",,"Input Error"
    else
    MsgBox "Cap number " & add.txtcap.value & " has been added!",,"Add Alert"
    Add.Submit
    self.close
    END IF



    The main form is like this
    <td>&nbsp;&nbsp;<A HREF="javascriptopUp('addcap.asp')">*CAP #</FONT></td>

    <FORM NAME="Addproj" ACTION="addproj.asp" METHOD=post>
    <td>&nbsp;&nbsp;<input id="txtcap" style="FONT-SIZE: xx-small" maxLength="5" size="13" name="txtcap" value="<%=Request.querystring("txtcap")%>"></></td>
    </form>

  12. #12
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    The main form is like this
    <td> <A HREF="javascriptopUp('addcap.asp')">*CAP #</FONT></td>

    <FORM NAME="Addproj" ACTION="addproj.asp" METHOD=post>
    <td> <input id="txtcap" style="FONT-SIZE: xx-small" maxLength="5" size="13" name="txtcap" value="<%=Request.querystring("txtcap")%>"></></td>
    </form>

    When you are using a href to open the popup then the form is not getting submited.

    try something like this

    <td> <A HREF="javascriptopUp('addcap.asp')">*CAP #</FONT></td>

    in your javascriptopUp function

    create the dynamic url and then open the file

    eg.

    url="addcap.asp?txtcap=" + documtnt.Addproj.txtCap.value ;

    that will submit the value to the addcap.asp file now.

    Hope this helps.
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  13. #13
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by realgoldn
    The user fills ouf the popbox then clicks submit the submit button submits the form then closes the popup box. So when the popup box closes I want the value they added on the popup form to be displayed on the main form. Hope this makes sense.
    This in an example i just put together. Modify it for your need.

    r1.asp
    Code:
    <head>
    <script>
    function Insert()
    {
    
    	var winW=475;
    	var winH=345;
    	var w=screen.width;
    	var h=screen.height;
    	var t=h/2-winH/2;
    	var l=w/2-winW/2;
    
    	var url = "r2.asp"
    	var hWnd = window.open(url,"","top=" + t + ", left=" + l + ", width=" + winW+ ",height=" + winH+ ",resizable=yes,status=yes,scrollbars=yes");
    
    	if ((document.window != null) && (!hWnd.opener))
    		hWnd.opener = document.window;
    }
    </script>
    </head>
    <body>
    <form name=form1>
    <input type=text name=text1 readonly>
    <input type=button name=btn1 value="Select Name" onclick="javascript:Insert()">
    </form>
    </body>
    r2.asp
    Code:
    <html>
    <head>
    <script>
    function Insert()
    {
    
    	//alert(document.form1.txt1.value);
    
    	window.opener.document.form1.text1.value=document.form1.txt1.value;
    	window.close();
    }
    
    
    </script>
    </head>
    
    <body>
    <form name="form1">
    <input type=text name="txt1"><br>
    <input type=button value="Click here to Insert" onclick="javascript:Insert()">
    </form>
    </body>
    </html>
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Mar 2004
    Posts
    182
    Thanks. I give this a try!

Posting Permissions

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



Click Here to Expand Forum to Full Width