Submit Button Action Based On Different Conditions?

Mar 16, 2011

I want my submit button to link to different pages, based on the value of a particular variable (let's call it total).

So, if 18 < total < 20, the submit button should redirect to page1.html
If 16 < total < 18, the submit button should redirect to page2.html
If 14 < total < 16, the submit button should redirect to page3.html

I have created page1.html, page2.html....page10.html. how should I link my submit button (I have only *one* submit button) to different pages based on different conditions?

View 9 Replies


ADVERTISEMENT

Way To Identify Conditions For My Submit Button ?

May 11, 2011

The following javascript coding is used in a "select a city" dropbox.

I made a submit button. I want the button to redirect the page to "page1.html". "page1.html" will be a webpage with events located in Auburn, Alabama, United States.

My submit button:

Here is my function:

Right now my button doesn't recognize if i select "Auburn", so it never sends me to "page1.html". Can someone please help me write the correct if statement?

View 12 Replies View Related

JQuery :: Change Form Action Based On Button Clicked?

Jun 12, 2009

I have a form like this:

<form id="my_form" method="post" action="">
Name: <br />
<input type="text" id="name" name="name" />
<input type="submit" id="submit1" value="Go to page 1" />
<input type="submit" id="submit2" value="Go to page 2" />
</form>

how can I change my action form so the form goes to Page1.htm with click on button1 and goes to Page2.htm to click on button2, and mantein the value inserted in textbox "name"?

View 4 Replies View Related

Multiple Action Of Button Submit (bypass Popup Blockers)?

Sep 26, 2009

I dont know much about the functionality on what causes some popups to trigger a browsers blocker and some not to.

Situation: I have an account information page (where users can edit their account details) one of the fields the user can edit comes at a cost. For billing I am using a 3rd party billing portal (standard form action pointing to the service & value is passed via post variable)

-user hits submit (not on the 3rd party billing form, my fake ajax button)a service is selected that cost $1 (lets say)verification DB is updated (no page reload)value field is updated in the 3rd party billing form to reflect the additional service I then initiate the form submit on the 3rd party billing form into a popup window I do not want to user to leave the site, I want the $1 billing window to pop up, they take care of it then close the window returning back to the site. In order to get the form to popup in a window I set the forms target to the popup window:

Code:
window.open("", paysys, "width=760,height=550"); functionality everything is working perfect, except most browsers catch the popped up window in their popup blockers. Anyone know how I can create a popup that isnt flagged by the browsers?

View 1 Replies View Related

JQuery :: Enabling Disabled Submit Button On Browser's Back Action?

Feb 3, 2010

when the following code is used in my JSP page:

$('#myForm').bind('submit', function() {
$('#submit').attr('disabled', 'disabled');
});

it disables the submit button when my form is submitted (IDs are used). This action displays a result page. If the browser's Back button is pressed to change some of entered items, the submit button in Firefox is still disabled, while the same action in MSIE8 enables it again. I don't know if this is exactly JavaScript/browser/chache issue, how to get the submit button enabled 'automatically' Unfortunately the refresh button in Firefox doesn't help either (probably JSP issue) - I have to press Enter on the address bar which is not very obvious for every user.

View 1 Replies View Related

Hide Div Based On Conditions?

Nov 24, 2010

I am trying to hide div based on conditions..This is the scenario: the div should never appear again for that user, until i write another server side message.lets say i write a message today saying " we are really sorry, but the website will be don for one hour today" and you login today, the message will be displayed, when you click close its closed,it wont appear again for you, until i post another message,but each message would have an expiration date, if i post a message which would be displayed to every user, i should decide how long i want it displayed, maybe 24 hrs, so in 24 hrs the message should no longer display.

View 5 Replies View Related

Hiding / Disabling Submit Button Based On Dropdown Selection

Nov 9, 2010

How can I hide/disable the submit button if the name Todd is selected?

View 7 Replies View Related

Disable/enable Submit Button Based On Existence Of Validation Errors?

May 1, 2010

Would anyone care to post your favorite script for disabling the submit button on a form when there are input errors, and reenabling when all errors are resolved? I'd be curious what the different approaches are to this. I looked through my various SitePoint javascript books and surprisingly didn't find an answer to this scenario specifically.The behavior I'm trying to achieve (most efficiently) is having a form start out with the submit button enabled, but if there is a validation error, such as a required field being left blank on blur, the submit button is disabled. It's easy then to re-enable it when the user fills in that field, but harder to get the script to check and see if there are any other lingering errors before going ahead and enabling it.

My natural inclination would be to just keep a count of errors that increments and decrements when errors occur and are resolved. Then the script would check to see that the error count is 0 before re-enabling the submit button. It seemed easy, but I think I'm getting mixed up somewhere in conflicts of variable scope, and it's not turning out right.A google search rendered an example where someone was using a string variable to store errors, concatenating and replacing data to the string as errors were logged/resolved.

View 5 Replies View Related

Multiple Action With Multiple Submit Button

May 17, 2006

how to assign multiple action with multiple submit button in the form.

View 2 Replies View Related

JQuery :: Trigger Alert When Button Clicked And Conditions Not Met?

Mar 6, 2011

Can't get this to work correctly. I need to run an alert if the user clicks the button "#step0Next" and none of the var ckd button's are checked [code]...

View 7 Replies View Related

Do Action Based On Random Number

May 5, 2009

The following code is supposed to provide a different alert message when a page is loaded, based on a random number generated on load. Can anybody see what is probably a very obvious problem that I just can't see?[code]

View 1 Replies View Related

No Action In Submit?

Dec 16, 2011

I have created a form for file upload based on cgi script. In form action attribute, i have called cgi script.

<form name="content" id="content" action="../cgi-bin/upload.cgi?upload_id=" method="POST" enctype="multipart/form-data" onsubmit="setValueforHidden(this)" target="xupload">
when the user presses the submit button(after form valdiation was over ) i have called the below api.
function StartUpload(f1)
{
var UID= Math.round ( 10000 * Math.random () ) + '0' + Math.round ( 10000 * Math.random() );

[Code]...

View 1 Replies View Related

AJAX :: Updating FORM Action Based On Input

Aug 2, 2011

Let me preface this by saying that I have ZERO experience with Ajax, and have simply copied this code from a blog elsewhere. What is shown below ties to a php file that I developed for a search function on our site. As the user enters their search term(s) in the text input field, the div below is populated with potential results through AJAX. I get all that.

However, I'd like to extend this a bit more. I'd like to enable to user to click the Enter key to follow the URL of the top search result automatically, without having to move their mouse and click on it.

Since I'm using PHP to generate the actual URL, I'm sure I can just send this back as a variable via AJAX, but with my lack of understanding, I thought I'd poke around here for some assistance. Can someone show me how to tweak the code below to accomplish what I'm looking for?

Code:

<script type="text/javascript">
function showResult(str)
{
if (str=="")

[Code].....

I'm less concerned about getting the Enter key to perform the submit than I am about passing the URL variable back to the form via AJAX. I've seen lots of examples of getting the Enter key to behave this way, I just didn't want to muddy up the original code above.

View 4 Replies View Related

Action Url Change On Submit Form

May 23, 2007

Is it possible to change URL form action on submit form...

I have tried such code:

<script language="JavaScript" type="text/javascript">
function changeURL()
{
......

View 1 Replies View Related

Change Action From Submit To ImageField?

Jan 4, 2010

I found this free script that I want to use on my order form (disables order button until agreed to terms by clicking checkbox). It is working, but I would like to use an image.gif-button instead of a Submit-button.

Would be grateful if someone could explain how to change in the script from "disable Submit-button"-action to "disable image.gif-button"-action. I've tried to do it myself, but I don't know much about Javascript, and couldn't get it to work.

My 2nd question: Can this type of action only be done in Javascript, or could there be a solution whereby the checkbox on the html-page calls a php-page to get the same type of validation?

The script:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Checkbox Form Validation</title>
<script type="text/javascript">

[Code]...

View 2 Replies View Related

Running PHP/MYSQL Script Asynchronously And Taking Action Based On Result?

Mar 25, 2011

I have a form on a web page, with one field to enter a code, to search for a property.On clicking 'submit' I want to be able to run a script asynchronously in the background.The script will need to run a MYSQL statement which will have one of these results:

1. The property code does not exist, so display a Javascript Alert saying it does not exist.

2. The property is for sale, so call an existing javscript function 'saleSubmit(propertyCode)' to overwrite the exsiting web page with a new page sale.php for that property code

3. The property is for rent, so call an existing javscript function 'rentSubmit(propertyCode)' to overwrite the exsiting web page with a new page rent.php for that property code

My slills are in PHP and MySQL and I have no knowledge of tools like Ajax, jQuery and I am currently having problems getting my head around it. I have spent ages visiting lots of websites looking for examples on how to do this with little success.

View 4 Replies View Related

JQuery :: Cancel The Submit Action Through Onclick?

Nov 4, 2010

I need to cancel the submit action via jquery through onclick. But its not working. Could you please advise me? I have copied my code below.

Code:-

<script language="javascript">
function validate(){
var prjname_selected=$("#prjname_selected").val();

[code]....

View 1 Replies View Related

Change Form And Action And Then Auto-Submit?

Nov 9, 2011

I have a body onload doing multiple things, changing a select option value, changing the form submit action and then auto submitting. Everything works fine until the auto submit part of it.

function run()
{
document.myform.myselect.selectedIndex = 1;
document.myform.action = 'page.php?x=1&y=2';
document.myform.submit();
}
<body onload="run()">

View 2 Replies View Related

Javascript And Struts Submit Action Lookup Dispatcher Problem

Jul 23, 2005

document.forms[0].action='/search.do?&submitaction=Add Minus'
document.forms[0].submit();

since i am working on struts then submitaction maps to through the
action dispatcher.

so where the action is mapperd as Add Minus it goes as Add%20%Minus because of the way i submitted. Is there any way i can make it go as Add Minus....

View 3 Replies View Related

Put A Script Action To A Button Tag?

Apr 11, 2009

How do I put a script action to a button tag? I tried the below, but it doesn't work:

<BUTTON TYPE="button">
<IMG SRC="up_left.jpg" onclick="alert($('#myselect').val())"/>
</BUTTON>

View 9 Replies View Related

Different Action In Different Radio Button?

Aug 20, 2009

I am making a form in which i am using two radio button.Now i want that if i click on first radio button and after that i will click on submit button then page should go different page .If i click on 2nd radio button and after that i submit page then page should go on different page.

View 2 Replies View Related

Multiple Action Done By Clicked Button

Jun 22, 2009

I have window containing a field.I was looking for a way to copy the value in the field and at the same time close the window.To close window i cleaned the copying code and insert this : 'javascript:window.close();' it worked perfectly too.But i don't know how to put the 2 codes in one line so that on click the button will copy the field value and close the window

View 1 Replies View Related

3 Submit Buttons - Stop Or Continue Form Execution With A Confirm Box On The Third Submit Button ?

Apr 23, 2009

On my form I have 3 submit buttons which handle different things.I am looking for a way to stop or continue form execution with a confirm box on the third submit button and the third only.I can't use onsubmit because that will trigger on all three buttons.

View 2 Replies View Related

JQuery :: Submit And Reloading Form Values After Submit Button Is Clicked?

Jul 13, 2011

In the following .submit function, I am attempting to grab the value of the selected option in the facilityCodes dropdown list when I click the submit button and then during the submit function,select the facilityCode again in the dropdown list when the page reloads and then disable the list so that the user cannot change it.However,the situation is when I reload the page after the submit button is clicked the dropdown defaults to the first option and the list is enabled.I apparently am not understanding how.submit works so that I'm selecting the option I'm defining in my code below and then disabling the list AFTER the page reloads due to an error on the page. My question is how can I accomplish this?Here is my code:

$(function() {
$("#ARTransferForm").submit(function() {
var msgsCount = 0;[code]....

View 1 Replies View Related

Submit The Form Data To The Popup Window Without A Submit Button

Jul 23, 2005

The following will submit the form data to popup by clicking the submit button. I want it will submit the form automatically to the popup, there is no submit button in this page. Basically this page should not show up.

<script type="text/javascript">
function submitmyform(f) {
f.target = 'foo'
window.open('',f.target,'menubar=no,scrollbars=no, width=800,height=800');
f.submit();
return false;
}
</script>

<form name="myform" action="popup.asp" target="_blank" method="post"
onsubmit="return submitmyform(this);">
<input type="hidden" name="item" value="item"/>
<input type="submit" value="submit to popup"/>
</form>

View 2 Replies View Related

JQuery :: Submit Form Using Text Link Rather Than Submit Button?

Sep 28, 2010

I'm using mailchimps signup box (they don't have a decent forum to ask on) on my website and want to adjust the submit button and change it to a normal link. Here's the button that submit's the form:

[Code]...

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved