|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Any option chosen in combo box, should carry the field values and refresh same page
I want to create a filter - kind of page.
Here, I have some filter fields - when these are chosen it should list the records only with these values that are chosen. For e.g. I have a filter for month. So, want to list the records only for that month. Also for week. How do I go about ? |
|
#2
|
|||
|
|||
|
<select name="fltr_floor" size=1 onchange="document.forms[0].submit()">
on change this statement takes me to the the page specified in forms's tag. <FORM name="addConf" method="post" action="uptConf.asp" onSubmit="return checkEmpty()"> So, how can I get the same page reloade with the values chosen in the combo ? |
|
#3
|
|||
|
|||
|
I'm sorry I don't quite understand
![]() You have an .asp page with a <form>...</form> Inside that <form>...</form> you have/build a <select>...</select> Inside that <select> you have an onchange attribute. When the user selects an item from your <select> you want to submit the <form>...</form> passing allong the selected value that the user has chosen! Is that correct? Vlince |
|
#4
|
|||
|
|||
|
yes. you are right.
I am trying out on various options. one of them is - <select name="fltr_floor" size=1 ID="Select7" onchange="rfrsh()"> <Script langauge=Javascript> function rfrsh() { document.addConf.action="bookConf_oneByOne.asp"; document.addConf.submit(); } </script> do you have some other simple solution to this ? |
|
#5
|
|||
|
|||
|
Simple...
Here, and listen carefully ![]() First you create your .asp page(let's call it test.asp for the exmaple) Then inside test.asp create a <form>...</form> like this: <form name="frmMain" action="results.asp" method="POST"> Notice the two things in bold, the action attribute is set to results.asp and the method attribute is set to POST that is **very** important Then inside your <form>...</form> create your <select>...</select>. Give your <select>...</select> a name attribute something like name="slcList" Then add your onchange attribute to your <select>...</select> The onchange attribute should call a javascript function that submits your <form>...</form> **OR** Do what you did which is even better, and that is: document.forms[0].submit() Now when the user selects an item from your <select>...</select> the <form>...</form> will be submitted to the results.asp page since that's what we've entered inside the action attribute of the <form> tag remember! Now all you need to do, is create the results.asp page like this: <%@ Language=VBScript %> <% Dim strValueSelectedByUser strValueSelectedByUser = Request.Form("slcList") 'FOR DEBUG ONLY 'Response.Write "-->" & strValueSelectedByUser & "<--<hr>" 'Response.End %> Notice that I've used the .Form NOT the .QueryString but why??? Because I've used the method="POST" inside the <form> tag remember! Now, if you don't want to send the <form>...</form> to the results.asp page then simply change that! you can even make the page test.asp submit to iteself and do the exact same thing if you wanted to! Hope this helps! Sincerely Vlince |
|
#6
|
|||
|
|||
|
Thank you Vlince.
But now, incase you redirect this asp page to another one then - I will loose all the FIELD values stored on this page. Thats the reason I wnat the same ASP page to be submitted as well refreshed. |
|
#7
|
|||
|
|||
|
Ok but YOU DIDN'T MENTION THAT!!!
You see how important little details can be! That changes everything..well almost Now, like I said, if you want, you can simply make your page submit to *iteself* then you wont lose what the user entered **OR** If you're using ASP 3.0, you can always take advantage of the Server.Transfer() method that should work too! Hope this helps! Sincerely Vlince |
|
#8
|
|||
|
|||
|
How do I - submit the page to itself without changing the file name in the <FROM> tags 'action' ? Meanwhile Iwill check with this server.Transfer().
|
|
#9
|
|||
|
|||
|
your form will change action to the page that it currently is, and the method remains POST
|
|
#10
|
|||
|
|||
|
Sorry, could not get you - unatratnag.
Regards, Ambs |
|
#11
|
|||
|
|||
|
Quote:
this is current code Code:
<form name="frmMain" action="results.asp" method="POST"> if your current page is blah.asp this is your new code Code:
<form name="frmMain" action="blah.asp" method="POST"> now, when you submit, the page will reload with a post to itself and posting that value to the page. All the page elements will now be blank before you piss your pants, they are not lost, they're hiding in the request.form object. let me take a stab in the dark here, you're new, lost and need help designing this page? Why are you submitting automatically on a onchange? Is this going to an email? Database? what? We can teach you that when you autosubmit to itself how to keep all the elements on the form to keep their value or insert into a DB, but maybe rather than we beat around the bush, you say, i want my form to do this this and that, and we can help you that way.... |
|
#12
|
|||
|
|||
|
I know what happens when you submit your form, and how to retrieve the field values from the sumbitted form and I am not new to this field.
I would request you to be more polite. Please go through the previous threads, this would explain things better. As I have said clearly - 1> <b>Donot want to change the 'action' page.</b> When I click submit button, it should go to the page specified in 'action' thats the reason do not want to change it. 2> <b>Refresh the current page, </b>only when an option is chosen from the combo. Just want a simpler solution, than the one tried. Again the same code is pasted here- <form action="uptConf.asp" method="post"> <select name="fltr_floor" size=1 ID="Select7" onchange="rfrsh()"> <Script langauge=Javascript> function rfrsh() { document.addConf.action="bookConf_oneByOne.asp"; document.addConf.submit(); } </script> This code works as I want - but if you could provide a simpler solution, it would help me. |
|
#13
|
|||
|
|||
|
sorry, had no idea it was offensive to be new, your page setup sounds bad and could possibly be set up better and you've never explained why you need it this way but if you're that vehement on it we'll let you keep it that way and i'll never offer to try and help your design again if it offends you this much.
in the future devshed tags are [ and not < ok, your code works fine and is not complicated at all, but this would be a client side solution and you want it out of client side? I guess i'm not understanding why you say it's complicated and want it simpiler..... You don't have a good option besides what you have here for asp < 2. You could set up some processing page and pre loads and stuff but it'd be tricky and would be way harder than this current situtation..... The Server.Execute function accepts a URL parameter, stops execution of the current page (where the call to the function is made), and transfers the current environment to the new page. When that new page finishes execution, then control returns to the calling page just after where the Server.Execute was called. (Server.Transfer works the same, however, upon completion of the execution of the new page, processing ends.) It's pretty self explanatory....in which case, you'd need to do this server side anyways with posting to self and then doing transfer checking to see what the value of submit and the combo box is, in which case, refer to current posting of mine. I hope this helps with no intentions of being impolite |
|
#14
|
|||
|
|||
|
ok - I really appreciate the thoughts but when I read the previous thread of yours it was quite offensive for me.
I really need help to constuctively use this forum, so would require good/healthy criticsm which would improve my way of presentation as well. Thank you so much. Have a great day. |
|
#15
|
|||
|
|||
|
not a problem, let us know if you want to go a server side only route with server.transfer or execute. Sadly if a user has disabled scripting langauges your method will not work =(
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Any option chosen in combo box, should carry the field values and refresh same page |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|