Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
Handling form content with JavaScript and Perl

I have a music project in Perl which also requires some JavaScript but I seem to be stuck. I need to execute a program (ffplay) as a command-line application so it runs without displaying a GUI window. The Perl handles the server end of things (sqlite database access). I need JavaScript because I display track names as a button, which when clicked is supposed to run 'ffplay' to play the track named in the button code. But the button click requires JavaScript.

When I click a track name button, it only displays the first track, no matter which one I click.

The following code extracts track names from the DB.

    $sth=$dbh->prepare (qq{select track from tracks where 
artistid=$ArtistID and cdid=$cdID order by track});
    $sth->execute();
    while(@records=$sth->fetchrow_array()) {
         $Track=$records[0];
print<<EndHTML;
<script>
var form=window.document.forms[0]
function process(form) {
        alert ("Track: " + form.elements.Track.value)
    }
</script>
EndHTML
        print qq{<form name="Player">};
        print qq{<input type="button" onClick="process(this.form)" name="Track" value="$Track"><br/>};
        print qq{</form>};
    }
    $sth->finish();
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

SOLVED.

Changed the JavaScript function :

    <html lang="en">
<head>
<script>
function process(value) {
    var form =document.Player
        alert ("Track: " + value)
    }
</script>
</head>
<body>

<form name="Player">
<button onClick="process(this.value)" name="Track1" value="[01] Evenfall.flac">[01] Evenfall.flac</button><br/>
<button onClick="process(this.value)" name="Track2" value="[02] 6am.flac">[02] 6am.flac</button><br/>
<button onClick="process(this.value)" name="Track3" value="[03] Cut.flac">[03] Cut.flac</button><br/>
</form>
</body>

Now the alert correctly tells me which button was clicked.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!