[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

coldfusion position scrollbar

Posted on 2012-09-10
6
Medium Priority
?
662 Views
Last Modified: 2012-09-12
Hi,

I have a page like this,
- the top part is
<cfform>
a form containing serveral textboxes and dropdown lists as filter + a button called "Filter". this button when click will call function to query database
</cfform>

- the second part is
<cfform>
  <table>
      a table to display retrieved records, plus a input column for user to enter comment on each row.
 </table>
 a button called "save" to save comment if there is any.
</cfform>

the retrieved records could be many. my question is when user work on entering comment on record which is close to the page bottom, how can the page go back to the modified record after the page reload due to button "save" click.

Please provide code example in detail since I am new.
Thanks much.
0
Comment
Question by:e126319
  • 2
  • 2
  • 2
6 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 38384470
Give each record a unique id.  then on the server when you go back to the page add #and the id to the end of the page url.


Cd&
0
 

Author Comment

by:e126319
ID: 38386906
Thanks for the reply, I have a javascript function to catch which cmnt field is clicked, and assigned it to a hidden field. could you provide a detailed steps how to use it, a code example?
0
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 750 total points
ID: 38387880
Okay if the var contains the id then you just append it to the url:

If the page you are sending back is http://mypage.html and the id of the comment was comment1 then the url going back should be would be http://mypage.html#comment1

I am not a cf expert so the best I can do as far as code is give you the PHP I use for such things:

$hash=[$_POST['hiddenfield'];
$url='http:/'. $_SERVER[REQUEST_URI] . $hash;
header("Location: $url");
exit;

Cd&
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LVL 53

Expert Comment

by:_agx_
ID: 38387976
(no points, COBOL already answered your question ...)

Are you posting the form to the same page or to a separate action page?
0
 

Author Comment

by:e126319
ID: 38391130
save button will save data and refresh the current page. I have a hidden field to keep the clicked field name,  here is what I have
<cfform name="form_Process" method="post" action="index.cfm?page=processWork&###Form.pos#"
pos is the hidden field name, and its value is the clicked field name. when run, I got error "pos is not defined in Form..." how do I reference form field in action property?
0
 
LVL 53

Accepted Solution

by:
_agx_ earned 750 total points
ID: 38391482
form variables don't exist until after the form is submitted. You must use javascript to get the position before it's submitted.  You can also use it to change the action of a form:

                var someForm = document.getElementById('idOfForm');
                someForm.action = 'newurlhere.cfm.....'; // changes the action
                someForm.submit(); // submits a form

Or you could use jquery/javascript to scroll to the element when the page loads

http://stackoverflow.com/questions/2905867/how-to-scroll-to-specific-item-using-jquery
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
There's never been a better time to become a computer scientist. Employment growth in the field is expected to reach 22% overall by 2020, and if you want to get in on the action, it’s a good idea to think about at least minoring in computer science …
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question