Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Forms manipulation

Posted on 1999-07-27
2
Medium Priority
?
178 Views
Last Modified: 2013-12-25
I wrote a html script which invokes a CGI script,
in CGI script based on some options, it is going to
create a dynamic form with some input fields like
buttons, checkboxes, etc.  
From this dynamic page, if someone clicks a button or a checkbox, i need to write some code for handling that.
Can you tell me how to check what button has been clicked and where to handle the event?
Shall i take javascript for doing this??

Any suggestions.....

Also in navigating between different forms, is it advisable to write that many htmls coupled with cgi scripts
OR
Do we go for one html with a static page and then handling
the remaining pages dynamically??

Thanks in advance
0
Comment
Question by:kirthir
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
DKostov earned 40 total points
ID: 1835252
>I wrote a html script which invokes a CGI script,
>in CGI script based on some options, it is going to
>create a dynamic form with some input fields like
>buttons, checkboxes, etc.    
>From this dynamic page, if someone clicks a button or a checkbox, i need to write some code >for handling that.
>Can you tell me how to check what button has been clicked and where to handle the event?
>Shall i take javascript for doing this??

>Any suggestions.....

I will start directly with an example. There will be different processing for one
checkbox and couple of buttons. The checkbox calls a java script when you click on
it. For the other two buttons you can verify the value of the hidden
"varWichButton" variable in your cgi. If its value is empty the "btnSubmit" is pressed.
If its value is equal to "1" - the "btnOther" is pressed. In this way you can manage
any other html control.

---------------------------------------------------------------------------------------
<HTML>
<HEAD>
      <TITLE>Sample form</TITLE>
      <SCRIPT LANGUAGE="JavaScript">
            function CheckBtnProc ()
            {
                  window.alert('Checkbox Pressed!');
            }
      </SCRIPT>
</HEAD>
<BODY>
<FORM NAME="frmYourForm" METHOD="POST" ACTION="/VirtDir/YourCgi.exe">
      <INPUT TYPE="HIDDEN" NAME="varWichButton" VALUE="">
      <input type="SUBMIT" name="btnSubmit" value="Submit">
      <input type="button" name="btnOther" value="Other"
            OnClick="this.form.varWichButton.value ='1';this.form.submit();">
      <input type="checkbox" name="btnCheck"  checked  OnClick="CheckBtnProc ();">
</FORM>
</BODY>
</HTML>
----------------------------------------------------------------------------------------

>Also in navigating between different forms, is it advisable to write that many htmls >coupled with cgi scripts
>OR
>Do we go for one html with a static page and then handling
>the remaining pages dynamically??

It depends on you, but on your place I will choose the first one method,
because in many cases using static html template you can make further changes
only on it, without change (or recompile) your cgi. Of course that's not
a rule.


Hope this helps :)

0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6872431
GREETINGS!

This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

730 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