Turning Form Actions On And Off With Javascript Or Some Tother Method
Oct 28, 2000
Does anybody know how to turn off form actions please?
I have 2 types of users (members and non-members) using the same form action. This form has 4 buttons in total.
If the user is a member they have full access to all buttons.
If the user is a non-member they can only use 2 of the 4 buttons.
So, at the moment, when they are non-members and click on one of the members buttons, an OnClick event handler is added to the input type = "submit", which generates a new window with a document explaining to the user that they need to register.
There is no problem generating this window.
The problem is that the form specified in the form action still executes and the members page is still displayed.
So is it possible to turn off the form action in this instance so that the main page isn't refreshed/executed, or do I have to create different form actions for different users.
Surely there must be a way to prevent the form action from being triggered?
I realise I could simply not display the button for non-members, but I'd prefer to do so, as it allows them to see the features that members receive.
View 3 Replies
ADVERTISEMENT
Apr 28, 2006
I have a simple SEARCH form which matches items from my supplier and delivers the results to the 'body' frame of my website. This works fine and here is the code.
<FORM ACTION="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" TARGET="body">
<INPUT TYPE=HIDDEN NAME="partner" VALUE="xxxxx">
<INPUT TYPE=HIDDEN NAME="partnerId" VALUE="xxxxx">
<INPUT TYPE=HIDDEN NAME="xxx" VALUE="xxxx">
<CENTER>
<P ALIGN=CENTER>
<INPUT TYPE=TEXT NAME="xxxxxxx" SIZE="25" MAXLENGTH="256"><FONT COLOR="WHITE">..<INPUT TYPE=SUBMIT VALUE="Go"><INPUT TYPE=RESET VALUE="Clear"></FONT>
</FORM></TD>
However what I would like to do is use the same SEARCH box information typed in to generate a second search at another supplier and deliver the results alongside in another frame. The frame part is easy enough but how can I get two Form Actions from one form?
I understand it cannot be done in HTML but it may be possible in Javascript.
View 1 Replies
View Related
Jul 23, 2007
I am building a web page.and have a simple javascript menu... I call
the javascript menu within a div block that my print sytlesheet has
set as a display: none;, well all the content in that block doesn't
show up, EXCEPT the javascript is still getting run Code:
View 3 Replies
View Related
Nov 20, 2011
I'm working on a web app where a profile is displayed to a user. The profile consists of data pulled from FB and LinkedIn via their respective API's. I'd like to provide the user with the ability to add more detail to the profile. I've scoured the web looking for a way to use Javascript to change an HTML element from a link to a form field but couldn't find exactly what I was looking for.
For example...
Profile:
Education: College Add Major
And when the user clicks the "Add Major" link, it turns into a form field. I'm not much of a front end developer but I'm working alone on this project so I have to wear a few hats.
View 6 Replies
View Related
Dec 29, 2005
I have a form. When the user clicks submit I would like form to be sent to two different cgi scripts.
View 7 Replies
View Related
Feb 10, 2010
I have the following function - where I can get one of the conditions to work, but not both together. Here's the code:
function test_function() {
$('#form_field_name').focus();
window.location = window.location + "#form_field_name";
}
Basically when clicking an error link, I want to focus onto the form field, and then move to the anchor itself on the page. One of these will work at a time, but not both and I'm not sure why.
View 5 Replies
View Related
Jan 27, 2009
I've got a form with some input fields with a submit button for SAVE and another for REMOVE.
Each button use the onclick to set the appropriate action link of the form. But I think this will just not work without JS so, is there any alternative for this?
View 4 Replies
View Related
Mar 31, 2011
I have a javascript code to let people subscribe to our newsletter. I would like to get a mail each time a person get subscribed to our newsletter. The code to let people subscribed to our newsletter is:
[Code].....
View 7 Replies
View Related
Jul 23, 2005
I am trying to have two form actions on submission using a
javascript. The first calls a php class (http://www.blah.org/test.php)
and the second adds data to a mySQL database via a php function call (<?
php echo $editFormAction; ?>. Both actions work; however, only the
second action in the fucntion runs. Here is the code:
<script language=javascript>
<!--
function But1()
{
document.form1.action = "http://www.blah.org/test.php"
document.SubmitAbstract.submit(); // Submit the page
document.SubmitAbstract.action = <?php echo $editFormAction; ?>;
document.SubmitAbstract.submit();
return true;
}
-->
</script>
In this example, the document.SubmitAbstract.action = <?php echo
$editFormAction; ?>; action works fine. If I reverse the order:
<script language=javascript>
<!--
function But1()
{
document.SubmitAbstract.action = <?php echo $editFormAction; ?>;
document.SubmitAbstract.submit();
document.form1.action = "http://www.blah.org/test.php"
document.SubmitAbstract.submit(); // Submit the page
return true;
}
-->
</script>
only the test.php file runs. Any ideas?
View 1 Replies
View Related
Oct 12, 2010
I've got a form that I need to go to two different places. First, I need it to submit a portion (but not all) of inputed data to one url (url.php). If that is successful, I need it to submit another portion of the inputed data to another url (url2.php). The trick is, I need the information from some fields to go to both places, but with different names.
Here's what I'm doing:
$(function() {
$('form').submit(function() {
return false;
$.ajax({
type: "POST",
url: 'url.php',
data: $('.string').serialize(),
success: function(){
$.ajax({
type: "POST",
url: 'url2.php',
data: 'firstname='+$('#Contact0FirstName').val()+'&'+'lastname='+$('#Contact0LastName').val()
});
}});
});
});
I have the information I need to go to url.php serialized by class (.string). Then, I try to make a string out of the data for url2.php. What seems to be happening the form is submitting ALL fields to url.php, ignoring the serialized string I told it to use, and then submitting ALL fields to url2.php, again ignoring the string I told it to use.
View 3 Replies
View Related
Mar 15, 2010
I have a form, and i want two alternative submit links done as <a> links.Essentially, one will 'save changes' and remain on the same page, the other will 'save and preview' the final content.I've been playing for a while and can't seem to get it to workIf i just use one button and set the form action as normal all works fine.I'm told that i can set the form action within a javascript function and submit the form from there, but the problem is that clicking the link now just goes to the 'href' on the save button without submitting the form. (I believe the href is still required to make a working link).My code is as follows (ive simplified it to the essential components being used, theres also some php bits in the action being set) :
Code:
<script type="text/javascript">
function docSave()
[code].....
View 5 Replies
View Related
Jul 29, 2007
I don't think this is "do-able" but thought I'd better check. Say I
want to replace certain names in some source code as long as they are
not properties (dot properties) of objects. I could use a regular
expression like:
rx = /(?:(.)|)(?:name1|name2|name3)/g;
map = [];
map["name1"] = "a";
map["name2"] = "b";
map["name3"] = "c";
source = source.replace(rx, function ($0, $1) {return $1?
$0:map[$0]});
Dot properties like .name1 are not replaced by anything new and they
need to be "skipped" over by this regular expression but other name1
identifiers need replacement with "a".
One problem with this approach is that dot properties like .name1 are
replaced by themselves and this is just unnecessary work. Something
like a "false" return to skip replacement would be nice but the
following doesn't work.
source = source.replace(rx, function ($0, $1) {return $1?
false:map[$0]});
There are other ways to get around this by using something else
besides replace() but I wanted to see if it could be done with the
replace() method.
View 9 Replies
View Related
Dec 1, 2005
i'd like to know if it's possible to send variables with the post method in a javascript instead of doing :
window.location.href = "page.php?var="+var;
using get method ! i'm asking this because i have many variables to pass and get method doesn't seem to be the best way !
View 4 Replies
View Related
Jun 5, 2006
I am trying to call a java method from within my Javascript, but cannot
seem to get it to work. All the examples I have found online and in
the forums are using Java applets. I have a method that I want to call
that does a search, and produces a message dialog displaying the
results. Also, the class file lives next to the html file. How would
I invoke this in my code? This is what I have now:
<script>
function searchStrings(){
Searcher.search();
}
</script>
<form>
<input type="button" value="Search" onclick=searchStrings()>
</form>
View 2 Replies
View Related
Jul 23, 2005
A Java applet has two methods stop() and destroy() that get called when the user moves to a different page. Does javascript have anything similar?
View 2 Replies
View Related
Jul 23, 2005
I am trying to determine whether the status bar is visible or not .. is
there a method to check the state? I did a google search and found
info re: window.status.visible but it returns undefined?! Has it been
deprecated?
View 2 Replies
View Related
Jun 6, 2007
I was trying:
Code:
<script>
function testtrim(value) {
alert(value.trim());
}
testtrim("Alex ");
</script>
The javascript don't work, my firebugs says:[value.trim is not a function] how to simulate an trim function?
View 4 Replies
View Related
Dec 11, 2006
I am trying to use the Goto method of the Word ActiveX object. I am
trying to open a document and go to a named bookmark. If I use this
code in VB it works, so I'm sure the approach is possible, I just can't
get JavaScript to work with it.
Here is the code I am using, the error I get from IE is Object
Expected:
Hope someone can help! Any help would be much appreciated
function PageLoad()
{
var WordApp = new ActiveXObject('Word.Application');
WordApp.Visible = true;
var documentlocation = crmForm.all.new_documentlocation.DataValue;
var wd = WordApp.Documents.Open(documentlocation);
wd.Select();
var Name = 'TestFred'
var wr = wd.Selection.GoTo(What : Word.WdGoToItem.wdGoToBookmark,Name :
'TestFred');
}
View 6 Replies
View Related
Nov 3, 2005
Can anyone redirect to any online tutorials, articles, code of how to upload a file using HTTP PUT method and JavaScript or VBScript to a server running Apache 2.0 that uses CGI + PERL.
How to create configuration entries in httpd.conf for supporting HTTP PUT method.
How to code with AJAX to post uploaded file content to the server using PUT method ?
View 1 Replies
View Related
Aug 23, 2005
The following code does not work. Can anyone help with modifying it?
<script type='text/javascript'>
function super2 ()
{
var theNum = prompt ('Please enter a number: ', ' ');
document.write ('Its superscript is: ' + <sup>theNum</sup>);
}
super2 ();
</script>
View 8 Replies
View Related
Jul 20, 2009
Hello...I assume this should be relatively simple but can't seem to figure it out and have searched all over the net.I have an .asp page that contains a form with multiple checkboxes for users to register for classes. When the classes fill up I want to be able to not allow them to register.
Right now I am doing the following:
function regclosed()
{
alert("Registration for this class has closed." + '
' + '
' + "Please select another class.");
this.checked=false;
}
Then for each checkbox I am using onclick = "regclosed()" The problem that I am having is that even though I only put the 'onclick' for certain checkboxes...as soon as I click a checkbox that has the regclosed() it clears every box that was checked - not just the one that has onclick="regclosed()"
View 11 Replies
View Related
Jul 23, 2005
I only use forms as input and output to javascripts. Many times I use
innerhtml to write to a <div> for output. I don't know of an
alternative for input.
I sometimes have problems if I use method="post" and just leave it off.
The browser tried to reload the page after the script ran. Sometimes I
am able to even leave off <form> and </form>. Could someone explain
when form and method are actually needed?
I responded in comp.lang.javascript to "Adding to fields with
onchange". I had to leave "method=" out to get it to work without
trying to reload the page.
View 1 Replies
View Related
Jul 23, 2005
Is it possible to turn on/off the scroll, caps, and num locks on a user's
computer using javascript? It's somewhat hard to explain what I need this
for, but if there is a way for this to be done, please let me know...
View 2 Replies
View Related
Jun 17, 2009
This is very stupid but I cannot make it work. I'm trying to turn the following:
$.post("search.php", { clientID: thisChannel.tblClient_id, channelID: thisChannel.tblChannel_Id, wordsToSearch: wordsSearchedfor }, function(data){
alert("data: " + data);
});
[Code].....
The first passes the variables with no problem, but I get an error with the ajax function, it is not passing the variables.
View 1 Replies
View Related
Jun 1, 2009
I have some jquery code:
var data = $("#mySortable tbody tr:eq(" + editpos + ")").find('input').serialize();
Now data will spit out something like name=John&surname=Doe
What I want to convert data to is:
[Code]...
View 2 Replies
View Related
Aug 11, 2011
Let's say I have a form and I want to check that form to see if all the fields are filled out...could I do this?
Or would I have to actually declare the full form name each time?
View 1 Replies
View Related