• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Button in html

cliftonite

Diamond Member
How can I capture a button click in HTML? Writing a script that by default prints the last 500 lines of a log file (this works fine). Now I need a button that will enable someone to view the next 500 lines. How can I capture this? Isnt the button syntax something like:

<INPUT TYPE='button' NAME='Next500lines' VALUE=?' So what would I change that would trigger the loop? Is there anyway to make it a boolean and check if (button) then blah blah, else blah ? Thanks for the help.
 
Originally posted by: MCrusty
you would use the onClick property followed by some javascript

onClick="javascript:myfunction()"


The script is in perl. So would I have to write a javascript function to evaluate the click? And then have perl read that?
 
It sounds like you don't really care if someone clicks the button, you really want someone to submit a form.

So you want to do
<form method=post name="nextrows" action="myscript.pl">
<input type=submit value="Next Rows" name="button">
</form>

So when someone clicks on the button(submitting the form) it will perform the action specified as in, goto myscript.pl and passing the values of the form using the post method.
 
Originally posted by: MCrusty
It sounds like you don't really care if someone clicks the button, you really want someone to submit a form.

So you want to do
<form method=post name="nextrows" action="myscript.pl">
<input type=submit value="Next Rows" name="button">
</form>

So when someone clicks on the button(submitting the form) it will perform the action specified as in, goto myscript.pl and passing the values of the form using the post method.

Well I dont really need a form because there is nothing to input but I just want to know when the user has hit a button, so that i can display the next 500 lines.


<p>MACID: <input type ="text" name="macid" MAXLENGTH="12"/></p>
<p><input type="submit" value="Search" /></p>
<p><input type="reset" value="Clear"/></P>


That was the form I used to get the macid. The the following code took the form input and appended it to the file format.

my $macid = $query->param('macid');

if ($macid) {
if($macid =~m/[0-9A-Fa-f]{12}/)
{
$mactxt = uc($macid).".txt";
$mtamac ="Mta" .lc($macid);
}

else {
print "Please enter a correct MAC ID", "\n";
exit;
}
}


what i need is a something like my $macid = $query->param('macid'); in perl to check if the button was pushed that way I can execute the code to print another 500 lines.
 
The easiest way to detect when they hit the button is to use a form. Otherwise you have depend on javascript, which can get messy depending on the software platforms you are working with.
 
<form method=post name="next500" action="myscript.pl">
<input type=submit value="next500" name="button">
</form>

but how would I detect that? if (my $macid = $query->param('next500'); would work? kind of like a boolean?
 
I'm not sure how you would detect it in perl, but do some googling.

Try html perl forms, that should get you quite a few good sites with LOTS of examples.
 
Add a hidden tag in your form and then just check for that value. That would be the quickest way without having to implement any Java.
<input type="hidden" name="view" value="next500">
 
Back
Top