Hi,
am new to asp. Please help me in this.

I have a form, with textfields, checkboxes etc.
On clicking save button, the control shouldnt go to a different page.
Same page needs to appear & not a diffferent page.
Am using javascript for client side scripting
& vbscript for server side scripting

Please help in this.

Recommended Answers

All 4 Replies

Actually that is the default behavior.
Check
1. what "action" for the form is.
2. If you have "server.transfer"
3. "response.redirect".
If you already have solved, post the solution. If this solves close the thread.

I have neither of the 2nd & 3rd option in my code.

action = the second page name

but If I remove this action element, it shows the same current page(without refreshing the page).

I actually want my current page to get reloaded after saving form data, when save button is clicked.

Please help!

you can use ajax...

or if you just want to submit the page and stay in the current page
usually use condition to read that page is submitted...
set the form action to current

<form action="yourcurrentpage.asp" method="GET">

add code in the beginning of the page to read that your page is submitted by read the submit button value

'if form submitted : read the request value from submit button
if request("btnsubmit") = "submit" then
        'put the submit data code here
        'don't forget to pass the value to the current form...
end if

i prefer you use the session variable or the hidden input to set a flag to show that you already submitted the data, so when user refresh the page, your data not being submitted again...

I have neither of the 2nd & 3rd option in my code.

action = the second page name

but If I remove this action element, it shows the same current page(without refreshing the page).

I actually want my current page to get reloaded after saving form data, when save button is clicked.

Please help!

To me, this means, your data is saved. Right? In ASP you will have to re-write the form values to the page. (In dot net, there is viewState and framework that takes care of it)

For ex. if you have one text box.

<input type='text' name='txtName' >
<button ...>

Now, when page is submitted, you got the value from Form and saved it. So you have to take that value and re-assign. Means code changes to:

dim aName
aName = Request["txtName"]
'save aName to database... that is upto you

<input type='text' name='txtName' value='<%Response.write aName %>'>
<button ...>

you could use <%= shortform for response.write.
Tell me if it helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.