473,379 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Submit forms with 'multiple submitbuttons' with javascript

I'm rewriting a webshop where all the "ugly submitbuttons" are changed
with more complexed and nice looking <a href="#" onclick="">'s

So here is the case, in the form there are several submitbuttons that
makes the backend javaengine deside what do do;

<input type=submit name="More<%= question.getAttributeKey().toString()
%>" value="<isa:translate key="marketing.jsp.ChangeFields"/>">
<input type=text name="SaveMktProfile" value="<isa:translate
key="b2c.marketing.profile.saveButton"/>" class="FancyButton">
<input type=text name="CancelMktProfile" value="<isa:translate
key="marketing.jsp.Cancel"/>" class="FancyButton">

(makes the buttons; more, save and cancel)

How can I submit the form with javascript?
I tried make a dummy field <input type=hidden name="dummy"
value="xxx"> and call the submitscript:

<a href="javascript:Submitscript('SaveMktProfile')">

<script>
function submitscript(action){
document.form[1].dummy.name=action;
documen.form[1].submit();
}
</script>

but this don't work..

Have I just misunderstand the whole thing!?
Jul 20 '05 #1
1 1301
Hello,

You can submit as: theForm.submit()

If you want to know what to do on submit, add a hidden field and change its
value to denote what action to be done as:

<input type='hidden' name='whattodo' value='x'>
<script>
function submitDoThis(theform)
{
theform.whattodo.value = 'dothis';
theform.submit();
}

function submitDoThat(theform)
{
theform.whattodo.value = 'dothat';
theform.submit();
}
</script>

Later in your server page you can check the variable 'whattodo' and decide
what to do based on its value.

HTH,
Elias
"kjex" <ar********@hotmail.com> wrote in message
news:ce*************************@posting.google.co m...
I'm rewriting a webshop where all the "ugly submitbuttons" are changed
with more complexed and nice looking <a href="#" onclick="">'s

So here is the case, in the form there are several submitbuttons that
makes the backend javaengine deside what do do;

<input type=submit name="More<%= question.getAttributeKey().toString()
%>" value="<isa:translate key="marketing.jsp.ChangeFields"/>">
<input type=text name="SaveMktProfile" value="<isa:translate
key="b2c.marketing.profile.saveButton"/>" class="FancyButton">
<input type=text name="CancelMktProfile" value="<isa:translate
key="marketing.jsp.Cancel"/>" class="FancyButton">

(makes the buttons; more, save and cancel)

How can I submit the form with javascript?
I tried make a dummy field <input type=hidden name="dummy"
value="xxx"> and call the submitscript:

<a href="javascript:Submitscript('SaveMktProfile')">

<script>
function submitscript(action){
document.form[1].dummy.name=action;
documen.form[1].submit();
}
</script>

but this don't work..

Have I just misunderstand the whole thing!?

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Slug | last post by:
Hello, I've tried to find this answer, but can't seem to get a clear example - I'm using the following classic asp code to submit a form: <form action="default.asp" name=order method=post> ...
2
by: sandyde2 | last post by:
Hi all, I get the tough problem and expect to get help.. In a html page, I dynamically created many forms which named as NO+business_id. In each form there are two submit buttons to...
1
by: Matt | last post by:
The problem is I have 3 buttons that need to submit the form to different URL. My approach is to declare <input type="submit"> rather than <input type="button">. And put the following in the...
7
by: sindre | last post by:
Hi, Some place I use links to submit forms instead of a submit button. The way I have done this is: <a href="javascript:document.getElementById('<?php print "delete$i"...
2
by: Ghafran Abbas | last post by:
Call this function from the Page_OnLoad event of your asp.net page. This will prevent the user from doing multiple post backs or button clicks. This was designed to not disable the button, because...
1
by: Bill_W_Stephens | last post by:
I have a complicated page with several submit buttons. I don't want to create multiple forms because much of the input is shared and the code is getting very ugly. However I would like to determine...
5
by: Alex Maghen | last post by:
In ASPX 2.0 with MasterPages and all that, my entire page only has one actual <FORM>. But there are several different sections of the page that provide what are functionally separate forms with...
9
bhing
by: bhing | last post by:
Hi, please help me. I have a few forms and I need send there forms by one submit input. They have the same form action and almost the same fields. It is like a referral page. for example ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.