Search Results

Search found 175 results on 7 pages for 'onsubmit'.

Page 4/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • Form repeats values

    - by Tunji Gbadamosi
    I have a dynamically generated form to accept guest details and store the results into the a session array. However, when I retrieve the details, I keep finding that the last two guest details are always the same even though different inputs were given. Here's my form for getting the values (guests.php): <?php session_start(); require_once 'FormDB.php'; include 'connect.php'; include 'guests_.php'; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Enter guest details</title> <script language="JavaScript" type="text/javascript" src="validation_functions.js"></script> </head> <body> <?php if($_SESSION['logged_in']){ //print '<script type="text/javascript">'; //print 'alert("You have successfully logged in '. $_SESSION['volunteer']['first_name'].'")'; //print '</script>'; $first_name="first_name"; $surname="surname"; $sex="sex"; $age = "age"; echo $error; //echo '<form name="choose" action="tables.php" method="post" onsubmit="return validate_guests(this);">'; echo '<form name="choose" action="guests.php" method="post" onsubmit="return validate_guests(this);">'; echo '<input type="hidden" name="hidden_value" value="'.$_SESSION['no_guests'].'" />'; if($_SESSION['no_guests'] >= 1){ echo '<table border="1">'; echo '<th>First Name</th>'; echo '<th>Surname</th>'; echo '<th>Day of Birth</th>'; echo '<th>Month of Birth</th>'; echo '<th>Year of Birth</th>'; echo '<th>Sex</th>'; //echo '<div id="volunteer">'; echo '<tr>'; echo '<td>'; echo $_SESSION['volunteer']['first_name']; echo '</td>'; echo '<td>'; echo $_SESSION['volunteer']['surname']; echo '</td>'; echo '<td>'; echo $_SESSION['volunteer']['dob_day']; echo '</td>'; echo '<td>'; echo $_SESSION['volunteer']['dob_month']; echo '</td>'; echo '<td>'; echo $_SESSION['volunteer']['dob_year']; echo '</td>'; echo '<td>'; echo $_SESSION['volunteer']['sex']; echo '</td>'; echo '</tr>'; //echo '</div>'; for($i=0;$i<$_SESSION['no_guests'];$i++){ //$guest = "guest_".$i; //echo '<div class="'.$guest.'">'; echo '<tr>'; echo '<td>'; echo '<input type="text" name="guest['.$i.']['.$first_name.']" id="fn'.$i.'">'; echo '</td>'; echo '<td>'; echo '<input type="text" name="guest['.$i.']['.$surname.']" id="surname'.$i.'">'; echo '</td>'; echo '<td>'; echo '<select name="guest['.$i.'][dob_day]" id="dob_day'.$i.'">'; for($j=1;$j<32;$j++){ echo"<option value='$j'>$j</option>"; } echo '</select>'; echo '</td>'; echo '<td>'; echo '<select name="guest['.$i.'][dob_month] id="dob_month'.$i.'">'; for($j=0;$j<sizeof($month);$j++){ $value = ($j + 1); echo"<option value='$value'>$month[$j]</option>"; } echo '</select>'; echo '</td>'; echo '<td>'; echo '<select name="guest['.$i.'][dob_year] id="dob_year'.$i.'">'; for($j=1900;$j<$year_limit;$j++){ echo"<option value='$j'>$j</option>"; } echo '</select>'; echo '</td>'; echo '<td>'; echo '<select name="guest['.$i.']['.$sex.']" id="sex'.$i.'">'; echo '<option>Female</option>'; echo '<option>Male</option>'; echo '</select>'; echo '</td>'; echo '</tr>'; //echo '</div>'; } echo '</table>'; } else{ echo '<table border="1">'; echo '<th>First Name</th>'; echo '<th>Surname</th>'; echo '<th>Day of Birth</th>'; echo '<th>Month of Birth</th>'; echo '<th>Year of Birth</th>'; echo '<th>Sex</th>'; echo '<th>Table</th>'; echo '<th>Seat</th>'; echo '<th>Menu</th>'; //echo '<div id="volunteer">'; echo '<tr>'; echo '<td>'; echo $_SESSION['volunteer']['first_name']; echo '</td>'; echo '<td>'; echo $_SESSION['volunteer']['surname']; echo '</td>'; echo '<td>'; echo $_SESSION['volunteer']['dob_day']; echo '</td>'; echo '<td>'; echo $_SESSION['volunteer']['dob_month']; echo '</td>'; echo '<td>'; echo $_SESSION['volunteer']['dob_year']; echo '</td>'; echo '<td>'; echo $_SESSION['volunteer']['sex']; echo '</td>'; echo '</tr>'; //echo '</div>'; } echo '</table>'; echo '<input type="submit" value="Submit">'; echo '</form>'; } else{ print '<script type="text/javascript">'; print 'alert("You have not successfully logged in '. $_SESSION['volunteer']['first_name'].'")'; print '</script>'; } ?> </body> Here's my code for processing the details (guests_.php): <?php $error = ""; if($_POST){ //$guests = array(); $guests = isset($_POST['guest']) ? $_POST['guest'] : null; if($guests){ foreach($guests as &$guest){ $guest['first_name'] = ucwords(strip_tags($guest['first_name'])); $guest['surname'] = ucwords(strip_tags($guest['surname'])); $guest['dob_day'] = ucwords(strip_tags($guest['dob_day'])); $guest['dob_month'] = ucwords(strip_tags($guest['dob_month'])); $guest['dob_year'] = ucwords(strip_tags($guest['dob_year'])); $guest['sex'] = ucwords(strip_tags($guest['sex'])); } } foreach($guests as $guest){ $date = $form->create_date($guest['dob_day'], $guest['dob_month'], $guest['dob_year']); $exist = $form->user_exists($guest['first_name'], $guest['surname'], $date, $guest['sex']); if($exist != ""){ $error .= $exist; } } if($error == ""){ //$_SESSION['existent_guests'] = FALSE; $_SESSION['guests'] = $guests; $form->set_guests($_SESSION['guests']); //$form->set_volunteer($_SESSION['volunteer']); header("location: tables.php"); exit(); } } ?>

    Read the article

  • Internet explorer only executing function inside jQuery ajax success response once even though there

    - by user249950
    Hi, I have a function that uses jQuery.load() to call in 3 snippets of forms from different pages and then on the success text status it tries to load a colour picker: $(document).ready(function() { function ajax_form(putloadingboxhere, putsnippethere, snippeturl) { $(putsnippethere).load(snippeturl, function (responseText, textStatus, XMLHttpRequest, ) { if (textStatus == "success") { alert('One') $("input.pickcolor").ColorPicker({ onShow: function (colpkr) { $(colpkr).fadeIn(500); return false; }, onSubmit: function(hsb, hex, rgb, el) { $(el).val(hex); $(el).ColorPickerHide(); $(el).siblings('.colorpreview').css('background-color', '#' + hex); }, onBeforeShow: function () { $(this).ColorPickerSetColor(this.value); } }) .bind('keyup', function(){ $(this).ColorPickerSetColor(this.value); }); alert('Two') } if (textStatus == "error") { // Show error message } }); } ajax_form('tab_box', '#formone', 'snippet_one.htm #snippet'); ajax_form('tab_box', '#formtwo', 'snippet_two_copy.htm #snippet'); ajax_form('tab_box', '#formthree', 'snippet_three.htm #snippet'); }); It works fine in Firefox and Safari but (surprise, surprise) IE has a problem with it. I have added an alert to see what is going on before and after one of the functions. FF & Safari & IE8: Alert 'one' and Alert 'two' appear three times as expected and colour picker appears. IE6 & 7: Alert 'one' shows three times and colour picker does not appear. Any help would be great! Cheers. EDIT The line IE is referring to when it throws this error: 'Error: Object doesn't support this property or method.' is: $('input.pickcolor').ColorPicker Anyone got any insights? Thanks

    Read the article

  • calling Valums Ajax uploader from other DOM element

    - by Marc
    I'm facing a problem with the valums Ajax File upload. Since the plugin is working perfectly after a few modifications on the server side, I cannot implement a specific behavior. My DOM is composed with an input file plus the container to instantiate the fileuploader buttons. What I want is to be able to fire the fileuploader plugins when clicking on the input:file[name="upload-file"]. ... <div id="upload-accepted"> <fieldset> <label for="upload-file">Select a file:</label> <input type="file" name="upload-file" id="upload-file"/> <noscript> <p>Please enable JavaScript to use file uploader.</p> </noscript> </fieldset> <div id="upload-container"> </div> </div> ... <script type="text/javascript"> $(function() { var uploader = new qq.FileUploader({ action: '/file-upload', element: document.getElementById('upload-container'), onSubmit: function(id, filename){...}, onComplete: function(id, fileName, responseJSON){...} }); }); </script> I have tried to add the following on the script but it don't works $("#upload-file").live('change', function(event) { event.preventDefault(); $('.qq-upload-button').trigger('click'); return false; }); Any clues? Thanks in advance!

    Read the article

  • Rails RJS template displays code instead of the html page

    - by Anand
    After having Googled and hurting my brain for hours on this, I finally decided to post this question. Here's the code... view1.html.erb -------------- <%=link_to_remote_redbox "Link", :url => {:action => :action1, :id => @some.id} some_controller.rb ------------------ def action1 render :layout => false end def action2 do some processing end action1.html.erb -------------------- <form onsubmit="new Ajax.Request('/some_controller/action2', {asynchronous:true, evalScripts:true, onComplete:function(request){RedBox.close(); return false;}, parameters:Form.serialize(this)}); return false;}" method="post" action="/some_controller/action2"> <input type=text name='username'> <input type='submit' value='submit'> </form> action2.rjs ----------- page.replace_html("some_div", (render(:partial => "some_partial"))) with that code in place when action2.rjs kicks in it should display the html page instead I am getting this Element.update("some_div", "<style type=\"text/css\">\n\n.............. As suggested on other posts I read, they say its caused because of the ":update = some_div" in the link_to_remote_redbox function but clearly my code doesn't have that. Help is always appreciated. Many Thanks

    Read the article

  • How can I get jQuery validation plugin Ketchup to stop an Ajax form submission when validation fails?

    - by Marshall Sontag
    I'm using Ruby on Rails, Formtastic gem, jQuery and ketchup to validate my form. I'm submitting the form created by Formtastic inside a modal box using ajax: <% semantic_form_remote_for @contact_form, :url => '/request/contact' do |f| %> I have a validation plugin verifying the fields on the form: $(document).ready(function() { $("#new_contact_form").ketchup(); }); The problem is that semantic_form_remote_for generates an onSubmit ajax request that the jQuery validation plugins won't prevent, since it's not a normal form submission. One question on stackoverflow suggests using :condition on the remote form declaration to fire a javascript function, but I can't do that since I'm not using a function, but rather relying on a jQuery handler. I also tried putting ketchup within a submit event handler: $(document).ready(function() { $("#new_contact_form").submit(function() { $('#new_contact_form').ketchup(); }); }); No luck. Form still submits. I also tried using the beforeSend option of jQuery.ajax: $(document).ready(function() { jQuery.ajax( { beforeSend: function(){ $('#new_contact_form').ketchup(); } }); }); Validation fires off, but form is still submitted. I switched to jQuery Validation plugin just to see if it was due to some limitation in Ketchup. It turns out that Validation has a submitHandler option: $(document).ready(function() { $('#new_contact_form').validate({ submitHandler: function(form) { jQuery.ajax({ data:jQuery.param(jQuery('#new_contact_form').serializeArray()), dataType:'script', type:'post', url:'/request/contact' }); return false; } }); }); This works when I use a regular semantic_form_for instead of semantic_form_remote_for, but alas, I would rather use Ketchup. Is Ketchup just woefully lacking? Am I forced to use jQuery Validation?

    Read the article

  • JQuery Validation Plugin: Prevent validation issue on nested form

    - by Majid
    I have a form on which I use validation. This form has a section for photo upload. Initially this section contains six elements with the following code: <img class="photo_upload" src="image/app/photo_upload.jpg"> I have bound a function to the click event for the class of photo_upload. This function replaces the image with a minimal form with this code: Copy code <form onsubmit="startUploadImage();" target="control_target" enctype="multipart/form-data" method="post" action="index.php"> <input type="hidden" value="add_image" name="service"> <input type="hidden" value="1000000" name="MAX_FILE_SIZE"> <input type="file" size="10" name="photo" id="photo_file_upload"><br> <button onclick="javascript:cancel_photo_upload();return false;">Cancel</button> </form> So, essentially, after the image is clicked, I'd have a new form nested in my original, validated form. Now, when I use this new form and upload an image, I receive an error (repeated three times) saying: validator is undefined http://host.com/path/index.php Line 286 What is going on here? My guess is this Submit event bubbles up to the outer form As we have validation on that form, validation is triggered, Validation tries to find the form triggering it, Since we have not bound validation to the inner form it returns 'undefined' Now, is my assessment correct? Whether it is or not, how can I solve this issue?

    Read the article

  • Asp.net PopupControlExtender inside UpdatePabel

    - by user296422
    Hi, So i use PopupControlExtender (to edit some of the fields) inside ListViewControl which itself is embeded inside an UpdatePanel. The problem is as follows whenever you cause partail postback the popup panels are created client side outside the updatepanel. And you get more clientside controls with the same clientside ID. When you postback with popup panel the server side control eg. Texbox has Text = clientsidecontrol1.text, clientsidecontrol2.text, clientsidecontrol.text3 Is there a way to prevent this. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Secure_Test" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </cc1:ToolkitScriptManager> <div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="InputLabel" runat="server" Text="Whatever you put in the textbox"></asp:Label> <br /> <asp:Label runat="server"> <%= DateTime.Now.ToString() %></asp:Label> <br /> <asp:Button ID="Button1" runat="server" Text="Refresh" /> <br /> <asp:LinkButton ID="PopupLB" runat="server">Popup</asp:LinkButton> <br /> <cc1:PopupControlExtender ID="PopupControlExtender1" runat="server" PopupControlID="Panel1" TargetControlID="PopupLB" CommitProperty="Value"> </cc1:PopupControlExtender> <asp:Panel ID="Panel1" runat="server"> <asp:UpdatePanel ID="UpdatePanel2" runat="server"> <ContentTemplate> <asp:TextBox ID="InputTB" runat="server"></asp:TextBox> <asp:Button ID="SubmitBTN" runat="server" Text="Submit" onclick="SubmitBTN_Click" UseSubmitBehavior="false" /> </ContentTemplate> </asp:UpdatePanel> </asp:Panel> </ContentTemplate> </asp:UpdatePanel> </div> </form> </body> </html> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using AjaxControlToolkit; public partial class Secure_Test : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void SubmitBTN_Click(object sender, EventArgs e) { PopupControlExtender pce = AjaxControlToolkit.PopupControlExtender.GetProxyForCurrentPopup(Page); pce.Commit("Popup"); InputLabel.Text = InputTB.Text; } } To make it easier to test i post the code of an example page i used for testing. To make myself clear here is an example: i click Popup. Type "asdf" in the textbox and click Submit. InputPanel dispalys "asdf" i click Popup again. Type "qwerty" in the textbox and click Submit. InputPanel now displays "qwerty,asdf" When you check it the firebug you get this: <form id="form1" action="Test.aspx" method="post" name="form1"> <div> <input type="hidden" value=";;AjaxControlToolkit, Version=3.0.30930.21526, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e:pl-PL:c83bc095-c5d9-40da-b175-dc46338fcc3a:865923e8:91bd373d:596d588c:411fea1c:e7c87f07:bbfda34c:30a78ec5:42b7c466;" id="ToolkitScriptManager1_HiddenField" name="ToolkitScriptManager1_HiddenField"> </div> <script type="text/javascript"> //&lt;![CDATA[ var theForm = document.forms['form1']; if (!theForm) { theForm = document.form1; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]&gt; </script> <script type="text/javascript" src="/WebResource.axd?d=B2RAZw_YugtketKJqWIbXA2&amp;t=634051184591131846"></script> <script type="text/javascript" src="/ScriptResource.axd?d=zifZiisoqXYJSwLXuAZ4DmtrWVvn9x0W1r7qfDo40UU7q9QYoa5ChdBZD6dDL66f0flKVDmPL2woIPesut_FUpsFZUN2A5sDN7IOqPUOZO41&amp;t=1a45d080"></script> <script type="text/javascript"> //&lt;![CDATA[ if (typeof(Sys) === 'undefined') throw new Error('Ladowanie struktury strony klienta ASP.NET Ajax nie powiodlo sie.'); //]]&gt; </script> <script type="text/javascript" src="/ScriptResource.axd?d=zifZiisoqXYJSwLXuAZ4DmtrWVvn9x0W1r7qfDo40UU7q9QYoa5ChdBZD6dDL66fyxEJaYB3uJEQ0r_TmOPczeBZ1gpFH5a6x4ug130lptsKAcGA3S1vt08sHQo5sFtH0&amp;t=1a45d080"></script> <script type="text/javascript" src="/Secure/Test.aspx?_TSM_HiddenField_=ToolkitScriptManager1_HiddenField&amp;_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d3.0.30930.21526%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3apl-PL%3ac83bc095-c5d9-40da-b175-dc46338fcc3a%3a865923e8%3a91bd373d%3a596d588c%3a411fea1c%3ae7c87f07%3abbfda34c%3a30a78ec5%3a42b7c466"></script> <div> </div> <script type="text/javascript"> //&lt;![CDATA[ Sys.WebForms.PageRequestManager._initialize('ToolkitScriptManager1', document.getElementById('form1')); Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1','tUpdatePanel2'], [], [], 90); //]]&gt; </script> <div> <div id="UpdatePanel1"> <span id="InputLabel">qwerty,asdf</span> <br> <span>2010-06-15 18:26:50</span> <br> <input type="submit" id="Button1" value="Refresh" name="Button1"> <br> <a href="javascript:__doPostBack('PopupLB','')" id="PopupLB">Popup</a> <br> </div> </div> <script type="text/javascript"> //&lt;![CDATA[ (function() {var fn = function() {$get('ToolkitScriptManager1_HiddenField').value = '';Sys.Application.remove_init(fn);};Sys.Application.add_init(fn);})();Sys.Application.initialize(); Sys.Application.add_init(function() { $create(AjaxControlToolkit.PopupControlBehavior, {"CommitProperty":"Value","PopupControlID":"Panel1","dynamicServicePath":"/Secure/Test.aspx","id":"PopupControlExtender1"}, null, null, $get("PopupLB")); }); //]]&gt; </script> <div id="Panel1" style="position: absolute; left: 8px; top: 73px; z-index: 1000; display: none; visibility: hidden;"> <div id="UpdatePanel2"> <input type="text" id="InputTB" name="InputTB"> <input type="button" id="SubmitBTN" onclick="javascript:__doPostBack('SubmitBTN','')" value="Submit" name="SubmitBTN"> </div> </div><span style="display: none ! important;"><input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value=""></span><span style="display: none ! important;"><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value=""></span><span style="display: none ! important;"><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJMTkwNzc2NzAzD2QWAgIDD2QWAgIDD2QWAmYPZBYCAgEPDxYCHgRUZXh0BQtxd2VydHksYXNkZmRkZApLPc2nZUC+UkZsCrByuofHMah5"></span><span style="display: none ! important;"><input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBQLi2qWdAwKM54rGBgKIkJujDQKbjp+pDQKc7v+tArliNtJzeG8HrfsGBBXIViJAUGMz"></span><div id="Panel1" style="visibility: hidden; position: absolute; left: 8px; top: 73px; z-index: 1000; display: none;"> <div id="UpdatePanel2"> <input type="text" id="InputTB" value="asdf" name="InputTB"> <input type="button" id="SubmitBTN" onclick="javascript:__doPostBack('SubmitBTN','')" value="Submit" name="SubmitBTN"> </div> </div><div id="Panel1" style="display: none; visibility: hidden; position: absolute;"> <div id="UpdatePanel2"> <input type="text" id="InputTB" value="qwerty,asdf" name="InputTB"> <input type="button" id="SubmitBTN" onclick="javascript:__doPostBack('SubmitBTN','')" value="Submit" name="SubmitBTN"> </div> </div></form> InputTB and Panel1 where generated 3 time.

    Read the article

  • radio button to php

    - by Azzyh
    Hello so i have this form: <form action="javascript:DoSCInsert()" method="post"> <textarea onfocus="this.cleared=true;javascript:clearContents(this);" rows="5" cols="40" id="comment" name="comment">...</textarea> Yes: <input type="radio" value="Y" id="SCvoteY" name="vote"></input> No: <input type="radio" id="SCvoteN" value="N" name="vote"> </input> <input type="hidden" name="fID" id="fID" value="<? echo $_GET["id"]; ?>" /> <input onsubmit="if (!this.comment.cleared) clearContent(this.comment); return true;" type="submit" name="Submit" value="Stem!"/> </form> Anyway so i have this javascript also that tranfers the output info to insertSC.php: function DoSCInsert(){ $("#SCres").html("to sek.."); var nocache = '0'; var data = { fID : $("#fID").val(), SCvote : $("#SCvoteY").val(), SCvote : $("#SCvoteN").val(), comment: $("#comment").val(), nocache: nocache }; $.get('insertSC.php', data, onSCInsertComplete); } function onSCInsertComplete(data,textstatus){ $("#SCres").html(data); } and in my insertSC.php i have this: <?php echo $_GET['comment']." - ".$_GET['SCvoteY']; ?> Now i get out comment but no SCvoteY.... this is just a test i made, what i was really making is that you vote Y or N and then it inserts into the vote column Y or N(what you pickd) now i couldnt figure how to do it/something went wrong somewhere and now i cant even get out SCvoteY i just get undefined index What i need help with is what i just mention i want to when you either choose Y or N it should output what you choose. If you didnt choose any (empty isset?) then false.. else echo Y or N(what you picked)

    Read the article

  • JS encodeURIComponent result different from the one created by FORM

    - by Marco Demaio
    I thought values entered in forms are properly encoded by browsers. But this simple test shows it's not true: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title></title> </head><body> <form id="test" action="test_get_vs_encodeuri.html" method="GET" onsubmit="alert(encodeURIComponent(this.one.value));"> <input name="one" type="text" value="Euro-€"> <input type="submit" value="SUBMIT"> </form> </body></html> When hitting submit button: encodeURICompenent encodes input value into "Euro-%E2%82%AC" while browser into the GET query writes only a simple "Euro-%80" Could somone explain? Or is encodeURIComponent doing unnecessary conversions?

    Read the article

  • Basic File upload in GWT

    - by Maksim
    I'm trying to figure out how to upload one file using GWTs FileUpload widget. I'm using GWT and Google AppEngine with Java but I would like to upload file to my own Linux server. I have the following code already but now I can't figure out how to submit my file to the Google AppServer server and save it to another server: public class FileUploader{ private ControlPanel cp; private FormPanel form = new FormPanel(); private FileUpload fu = new FileUpload(); public FileUploader(ControlPanel cp) { this.cp = cp; this.cp.setPrimaryArea(getFileUploaderWidget()); } @SuppressWarnings("deprecation") public Widget getFileUploaderWidget() { form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); // form.setAction(/* WHAT SHOULD I PUT HERE */); VerticalPanel holder = new VerticalPanel(); fu.setName("upload"); holder.add(fu); holder.add(new Button("Submit", new ClickHandler() { public void onClick(ClickEvent event) { GWT.log("You selected: " + fu.getFilename(), null); form.submit(); } })); form.addSubmitHandler(new FormPanel.SubmitHandler() { public void onSubmit(SubmitEvent event) { if (!"".equalsIgnoreCase(fu.getFilename())) { GWT.log("UPLOADING FILE????", null); // NOW WHAT???? } else{ event.cancel(); // cancel the event } } }); form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { Window.alert(event.getResults()); } }); form.add(holder); return form; } } Now, what do I need to do next? What do i need to put in web.xml and how do I write my servlet so i can store file and return url of that object (if possible)

    Read the article

  • calll html button onclick event from asp server side login authenticate event

    - by CraigJSte
    Need to programmatically click an html button from a login event (code behind? the html button sends variables to Flash using method: no response - with no postback and uses ExternalInterface API via javascript. Going from SWF ASPX is great, but need to send User.Identity to SWF from ASPX via javascript after authenticate with login event which am having impossible time getting to work... (calling HTML event from Login button) tried scripting in javascript to login event with no luck, possibly because postback clears SWF variables - so perhaps keeping separate (login then html send) would work... Here is my relevant code: function sendToActionScript(value) { swfobject.getObjectById("Property").sendToActionScript(value); } </script> <object ..// SWF File embedded> </object <form id="form1" runat="server"> <asp:Login id="login1" OnAuthenticate="login1_Authenticate"/> </form> <form id="form" onsubmit="return false;"> <input type="text" name="input" id="input" value="" runat="server" /> <button id="btnInput" runat="server" causesvalidation="false" visible="true" style="width: 51px" onclick="sendToActionScript(this.form.input.value);" >Send</button><br /> </form> // CODE BEHIND protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { // do something to get User Id and Role //bind the string (user or role) to input.value //then call the HTML button onclick event to send it to SWF file. //which I could put in separate function and call from Login_Authenticate } Can anyone help me I am out of ideas. Craig

    Read the article

  • how do i keep form data after submitting the form using javascript?

    - by Lina
    When i submit this form, the values just disappears from the textboxes. I like them to stay printed in the textboxes. How do i do that? <form id="myform" method="get" action="" onSubmit="hello();"> <input id="hour" type="text" name="hour" style="width:30px; text-align:center;" /> : <input id="minute" type="text" name="minute" style="width:30px; text-align:center;" /> <br/> <input type="submit" value="Validate!" /> </form> <style type="text/css"> .error { color: red; font: 10pt verdana; padding-left: 10px } </style> <script type="text/javascript"> function hello(){ var hour = $("#hour").html(); alert(hour); } $(function() { // validate contact form on keyup and submit $("#myform").validate({ //set the rules for the fild names rules: { hour: { required: true, minlength: 1, maxlength: 2, range:[0,23] }, minute: { required: true, minlength: 1, maxlength: 2, range:[0,60] }, }, //set messages to appear inline messages: { hour: "Please enter a valid hour", minute: "Please enter a valid minute" } }); }); </script>

    Read the article

  • jQuery Validation plugin results in empty AJAX POST

    - by user305412
    Hi, I have tried to solve this issue for at couple of days with no luck. I have a form, where I use the validation plugin, and when I try to submit it, it submits empty vars. Now, if I remove the validation, everything works fine. Here is my implementation: $(document).ready(function(){ $("#myForm").validate({ rules: { field1: { required: true, minlength: 5 }, field2: { required: true, minlength: 10 } }, messages: { field1: "this is required", field2: "this is required", }, errorLabelContainer: $("#validate_msg"), invalidHandler: function(e, validator) { var errors = validator.numberOfInvalids(); if (errors) { $("#validate_div").show(); } }, onkeyup: false, success: false, submitHandler: function(form) { doAjaxPost(form); } }); }); function doAjaxPost(form) { // do some stuff $(form).ajaxSubmit(); return false; } As I wrote this does not work when I have my validation, BUT if I remove that, and just add an onsubmit="doAjaxPost(this.form); return false"; to my HTML form, it works - any clue??? Now here is the funny thing, everything works as it should in Safari, but not in firefox 3.6.2 (Mac OS X)!

    Read the article

  • Form Validation - IF field is blank THEN automatically selection option

    - by shovelshed
    Hi I need help to automatically select an option to submit with a form: When the 'form-email' field is blank i want it to select 'option 1' and, When the field is not blank i want it to select 'option 2'. Here's my form code <form method="post" onsubmit="return validate-category(this)" action="tdomf-form-post.php" id='tdomf_form1' name='tdomf_form1' class='tdomf_form'> <textarea title="Post Title" name="content-title-tf" id="form-content" >Say it...</textarea> <input type="text" value="" name="content-text-ta" id="form-email"/> <select name='categories' class='form-category' type="hidden"> <option value="3" type="hidden">Anonymous</option> <option value="4" type="hidden" selected="selected">Competition</option> </select> <input type="submit" value="Say it!" name="tdomf_form1_send" id="form-submit"/> </form> I have an idea that the javascript would go something like this, but can't find what the code is to change the value. <script type="text/javascript"> function validate-category(field) { with (field) { if (value==null||value=="") { select category 1 } else { select category 2 return true; } } } </script> Any help on this would be great. Thanks in advance.

    Read the article

  • Submit form with JS

    - by Thomas
    Im working with a shopping cart plugin and that uses a basic form on the product page to submit values like price, product name, etc.. The problem is that the plugin uses a standard submit button to send the values and I would like to replace said button with a prettier custom jquery rollover. In order to make this happen I used some JS and tossed a link around my custom submit button: <a href="#" onclick="document.forms[0].submit()" value="Add to Cart" onsubmit="return ReadForm(this, true);"> <img class="fade" src="style/img/add_btn.jpg" style="background: url(style/img/add_ro.png);" alt=""/> </a> The form submits and the user is redirected to the homepage but the data in the form doesn't seem to get submitted and the product never gets added to the 'cart' page. I suspect that the form is getting submitted but I am failing to fire some additional JS function that submits the data. The plugin adds some JS to the top of the page: <!-- // function ReadForm (obj1, tst) { // Read the user form var i,j,pos; val_total="";val_combo=""; for (i=0; i<obj1.length; i++) { // run entire form obj = obj1.elements[i]; // a form element if (obj.type == "select-one") { // just selects if (obj.name == "quantity" || obj.name == "amount") continue; pos = obj.selectedIndex; // which option selected val = obj.options[pos].value; // selected value val_combo = val_combo + "(" + val + ")"; } } // Now summarize everything we have processed above val_total = obj1.product_tmp.value + val_combo; obj1.product.value = val_total; } //--> If you want to check out the the site in question, take a look here and click 'add to cart button': http://hardtopdepot.com/?p=34 You can see the cart at the top: http://hardtopdepot.com/?page_id=50 Any help would be super appreciated- thanks!

    Read the article

  • Switching from form_for to remote_form_for problems with submit changes in Rails

    - by Matthias Günther
    Hi there, another day with Rails and today I want to use Ajax. linkt_remote_link for changing a text was pretty easy so I thought it would also be easy to switch my form_for loop just to an ajax request form with remote_form_for, but the problem with the remote_form_for is that it doesn't save my changes? Here the code that worked: <% form_for bill, :url => {:action => 'update', :id => bill.id} do |f| %> # make the processing e.g. displaying texfields and so on <%= submit_tag 'speichern'%> It produces the following html code: <form action="/adminbill/update/58" class="edit_bill" id="edit_bill_58" method="post"><div style="margin:0;padding:0;display:inline"><input name="_method" type="hidden" value="put" /></div> <!-- here the html things for the forms --> <input class="button" name="commit" type="submit" value="speichern" /> Here the code which don't save me the changes and submit them: <% remote_form_for bill, :url => {:action => 'update', :id => bill.id} do |f| %> # make the processing e.g. displaying texfields and so on <%= submit_tag 'speichern'%> It produces the following html code: <form action="/adminbill/update/58" class="edit_bill" id="edit_bill_58" method="post" onsubmit="$.ajax({data:$.param($(this).serializeArray()), dataType:'script', type:'post', url:'/adminbill/update/58'}); return false;"><div style="margin:0;padding:0;display:inline"><input name="_method" type="hidden" value="put" /></div> <!-- here the html things for the forms --> <input class="button" name="commit" type="submit" value="speichern" /> I don't know if I have to consider something special when using remote_form_for (see remote_form_for)

    Read the article

  • launch two actions in one button ASP.NET

    - by AZIRAR
    Hey, I'm developing a comment page in asp.net, this my page : <form action="#"> <p><textarea id="textArea" rows="5" cols="30"></textarea></p> <input type="submit" value="Submit" /> </form> <p>Add some comments to the page</p> And this is my javascript code : window.onload = initAll; function initAll() { document.getElementsByTagName("form")[0].onsubmit = addNode; } function addNode() { var inText = document.getElementById("textArea").value; var newText = document.createTextNode(inText); var newGraf = document.createElement("p"); newGraf.appendChild(newText); var docBody = document.getElementsByTagName("body")[0]; docBody.appendChild(newGraf); return false; } Until then, everything is fine, but I want when the user clicks the submit button, the button will trigger another action that will save the comment in the database. How can I do this thing ?

    Read the article

  • Validating age field

    - by Marcelo
    Hi people, I'm trying to validate an age field in a form but I'm having some problem. First I tried to make sure that the field will not be send empty. I don't know JavaScript so I searched some scripts and adapted them to this: function isInteger (s) { var i; if (isEmpty(s)) if (isInteger.arguments.length == 1) return 0; else return (isInteger.arguments[1] == true); for (i = 0; i < s.length; i++) { var c = s.charAt(i); if (!isDigit(c)) return false; } return true; } function isEmpty(s) { return ((s == null) || (s.length == 0)) } function validate_required(field,alerttxt) { with (field) { if (value==null||value=="") { alert(alerttxt);return false; } else { return true; } } } function validate_form(thisform) { with (thisform) { if ((validate_required(age,"Age must be filled out!")==false) || isInteger(age,"Age must be and int number")==false)) {email.focus();return false;} } } //html part <form action="doador.php" onsubmit="return validate_form(this)" method="post"> It's working fine for empty fields, but if I type any letters or characters in age field, it'll be sent and saved a 0 in my database. Can anyone help me? Sorry for any mistake in English, and thanks in anvance for your help.

    Read the article

  • Submit button not focused even though tabindex is properly set

    - by Nicsoft
    Hello, I have defined tabindex for the input fields in a form. When tabbing through the input fields the submit button is never getting the focus, some other input fields in a different form on the page gets the focus. Those are all having tabindexes higher than 3. How come? <form action="subscription.php" name="subscribe" method="post" onsubmit="return isValidEmailAndEqual()"> <p id="formlabel">E-mail</p> <input type="text" name="email1" tabindex=1> <br/> <p id="formlabel">Repeat e-mail</p> <input type="text" name="email2" tabindex=2> <br/> <input id="inputsubmit" type="submit" value="Subscribe" tabindex=3> </form> .css: input { background-color : #333; border: 1px solid #EEE; color: #EEE; margin-bottom: 6px; margin-top: 4px; padding: 1px; width : 200px; } #inputsubmit { background-color : #d7e6f1; border: 1px solid #EEE; color: #0000ff; margin-bottom: 6px; margin-top: 4px; padding: 1px; width : 200px; } #inputsubmit:hover { cursor: pointer; cursor: hand; background-color : #d7e6f1; border: 1px solid #0000ff; color: #0000ff; margin-bottom: 6px; margin-top: 4px; padding: 1px; width : 200px; } p#formlabel{ width: 100; } Thanks in advance!

    Read the article

  • How-to display a .gif as background image?

    - by Vito De Tullio
    Hi! I have a javascript "loading" function like this: function splashScreen() { var div = document.createElement('div'); div.appendChild(document.createTextNode("some text")); div.setAttribute("style", "position: fixed; " + "width: 100%; height: 100%; " + "left: 0; top: 0; " + "z-index: 1000; " + "background: #fff url('img/loading.gif') no-repeat center; " + "font-size: x-large; " + "text-align: center; " + "line-height: 3em; " + "opacity: 0.75; " + "filter: alpha(opacity=75); "); document.getElementsByTagName('body')[0].appendChild(div); return true; } I use this function in the form action (onsubmit="return splashScreen()") to show a "rotating logo" while the next page load... The problem is in that "img/loading.gif" and safari (on winXP): in ff and ie I have no problems, and I clearly see the animated gif. In safari I can't see it. If I change the image with a (obviously static) png the image appears... Am I doing something wrong? What's the problem with safari?

    Read the article

  • Javascript/PHP popup page problem

    - by Suezy
    I have a program in PHP that allows user to pop in a message, for confirmation from user. As seen below is the link i used. From inbox.php: echo "<a href='inbox.php' onclick=\"popup('acknowledge.php?id=$id')\"><font size=1px color=maroon>acknowledge</font></a></td>"; From acknowledge.php: if ($_POST['no']) { header("location: inbox.php"); } ?> <body bgcolor=skyblue> <center><form name=form1 method=post> <b><u> Acknowledge Message </u></b><br><br> Are you sure yout want to acknowledge this message?<br><br> <input type=button name=yes value="Yes"> &nbsp; <input type=submit name="no" value="No" onSubmit="window.close()"> </form> </center> </body> The problem is, everytime i click "no", to go back from previous page. It sets the page size the same as the popup page. It becomes smaller too. What's the problem? Answers are very much appreciated.

    Read the article

  • asp:login form does not submit when you hit enter

    - by Ben Liyanage
    I am having an issues while using the <asp:login> tag. When a user clicks the "login" button, the form will process correctly. However, when the user hits the enter key, the form self submits and does not process the login, whether it was correct information or not. I am using a combination of MasterPages, and Umbraco. My aspx code looks like this: <%@ Master Language="C#" MasterPageFile="/masterpages/AccountCenter.master" CodeFile="~/masterpages/Login.master.cs" Inherits="LoginPage" AutoEventWireup="true" %> <asp:Content ContentPlaceHolderID="RunwayMasterContentPlaceHolder" runat="server"> <div class="loginBox"> <div class="AspNet-Login-TitlePanel">Account Center Login</div> <asp:label id="output" runat="server"></asp:label> <asp:GridView runat="server" id="GridResults" AutoGenerateColumns="true"></asp:GridView> <asp:Login destinationpageurl="~/dashboard.aspx" ID="Login1" OnLoggedIn="onLogin" runat="server" TitleText="" FailureText="The login/password combination you provided is invalid." DisplayRememberMe="false"></asp:Login> </div> </asp:Content> In the actual rendered page, I see this javascript on the form: <form method="post" action="/dashboard.aspx?" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm"> That javascript function is defined as: <script type="text/javascript"> //<![CDATA[ function WebForm_OnSubmit() { if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false; return true; } //]]> </script> The javascript is always evaluating to True when it runs.

    Read the article

  • Jquery dialog confirmation, confirm form post

    - by user342391
    I am trying to display jquery's dialog confirmation before submitting a form. But I can't get it to popup up only when the form is submitted this is the code: $(function remove() { $("#dialog-confirm").dialog({ resizable: false, height:200, modal: true, buttons: { 'Delete campaign': function() { return true ; $(this).dialog('close'); }, Cancel: function() { return false; $(this).dialog('close'); } } }); }); Dialog confirmation content <div id="dialog-confirm" title="Delete ?" style="display:none;"> <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>This will be permanently deleted and cannot be recovered. Are you sure?</p> </div> Form submit content <form style="display: inline;" action="remove.php" method="post"" onsubmit="return remove()">

    Read the article

  • Validating Age field javascript beginner

    - by Marcelo
    Hi people, I'm trying to validate an age field in a form but I'm having some problem. First I tried to make sure that the field will not be send empty. I don't know javascript so I searched some scripts and adapted them to this: function isInteger (s) { var i; if (isEmpty(s)) if (isInteger.arguments.length == 1) return 0; else return (isInteger.arguments[1] == true); for (i = 0; i < s.length; i++) { var c = s.charAt(i); if (!isDigit(c)) return false; } return true; } function isEmpty(s) { return ((s == null) || (s.length == 0)) } function validate_required(field,alerttxt) { with (field) { if (value==null||value=="") { alert(alerttxt);return false; } else { return true; } } } function validate_form(thisform) { with (thisform) { if ((validate_required(age,"Age must be filled out!")==false) || isInteger(age,"Age must be and int number")==false)) {email.focus();return false;} } } //html part <form action="doador.php" onsubmit="return validate_form(this)" method="post"> It's working fine for empty fields, but if I type any letters or characters in age field, it'll be sent and saved a 0 in my database. Can any one help me ? Sorry for any mistake in English, and thanks in andvance for your help.

    Read the article

  • jQuery and IE not playing nice

    - by Neurofluxation
    Hello, I have this section of code: function createDownload() { var category, format, specification, download; $('#submitform').click(function() { category = $('#cate').val(); format = $('#form').val(); specification = $('#spec').val(); if (category == "NULL" || format == "NULL" || specification == "NULL") { alert("Please select all options."); return false; } else { download = "pdfs/"+specification+format+category+".pdf"; window.open(download); } }); } Now... In Internet Explorer it says there is an "Error on the page" - Message: 'return' statement outside of function and I have to click the button again. In Firefox, Chrome and Safari - I have to click the button twice to get the PDF to appear... (and no errors)... Now why could that be?! As per request - My Form declaration: <form method="post" action="javascript: return false;" onSubmit="createDownload();">

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >