Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to refresh a page created by shell script

Status
Not open for further replies.

adamf

Technical User
Mar 7, 2002
51
GB
Hi,

I currently have a web page which is a frameset (Horizontal frames) The bottom frame contains output from a shell script (ksh) which basically takes the latest 100 lines from a log, reverses the order & html-izes the output.

In the top frame I want to add a "refresh" button, which will then call the script & subsequently re-post the data in the bottom frame.

I'm not a cgi man by any stretch of the imagination, so any pointers/solutions gratefully received!

Thanks in advance!! Adam F
Solaris System Administrator
 
Actually, you can accomplish this via Javascript fairly simply. Below is some code that I use for updating a Ticket System page.

Code:
<SCRIPT LANGUAGE=&quot;Javascript&quot;>
<!--

function allopenbugs()
{

// Name of script goes here
document.pprplform.action = &quot;[URL unfurl="true"]http://www.domain.com/update&quot;[/URL]
// Name of the frame you're updating
document.pprplform.target = &quot;updateframe&quot;;
// Method used to send any data necessary
document.pprplform.method = &quot;post&quot;
document.pprplform.submit();
parent.pprplcontent.focus();
return true;

}

// -->
</SCRIPT>

Let me know if you'd like this explained in more detail.

- Rieekan
 
Rieekan,

Thanks for this... I am a complete java donkey, I'm afraid... SO as much infor as possible would be welcome!!

Thanks,

Adam Adam F
Solaris System Administrator
 
That's OK, after looking at this, it does seem a little forboding. Let me try to break down each line for you as well as add the HTML code that is needed to initiate this stuff. We start with the HTML code and will proceed in logical order to how each line is carried out.

Code:
<form name='pprplform'>
- Allowing you to set up the entering of form data

Code:
<input type='button' name='updateshell' value='Update List' onClick='allopenbugs();'>
- The button that will be clicked to update the page below. By using a JavaScript onClick event instead of just using a Submit button, allows you to perform certain functions before the submission actually happens. When this is clicked, the following occurs in your page:

Code:
 function allopenbugs()
- This line starts the JavaScript function that will submit the page for us.
Code:
{
document.pprplform.action = &quot;[URL unfurl="true"]http://www.domain.com/update.ksh&quot;[/URL]
- This line will tell the HTML page that when the form is submitted, it should be sent to
Code:
document.pprplform.target = &quot;updateframe&quot;;
- This line will allow you to set where the refresh of information will occur. By stating a target, you can tell a page to go to a specific frame or window that's already open.
Code:
document.pprplform.method = &quot;post&quot;
- Don't worry about this one unless you're also going to send data to the shell script. Then all you need to choose is if you want to post the data, or use a get.
Code:
document.pprplform.submit();
- Actually submits the form
Code:
parent.updateframe.focus();
- Places the focus of the page on the frame you just submitted an update for.
Code:
return true;
- Ends the function with a true statement.
Code:
}

- Rieekan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top