How to send this post without the submit - http-post

How to send this post without the submit?
I need that as I point to the this html page the form is posted without any button submission.
I am not so expert then please the example should be as simple as possible.
Many thanks for your help.
This is my Post base code:
<html>
<hr>
<b>Send sms text</b>
<br>
<br>
<form method=POST action="http://111.111.111.111:1111/smssend.cgi">
<table>
<tr>
<td> Destination number </td>
<td><input type=text name=num value="+39111111111" </td>
</tr>
<tr>
<td> Message text </td>
<td> <textarea name=text value="My message"></textarea></td>
</tr>
<tr>
<td> Password </td>
<td> <input type=text name=Pwd value="SMSxxx"></td>
</tr>
</table>
<input type=submit value=Send>
</form>
<hr>
</html>

Try the following code:
<html>
<head>
<script type="text/javascript">
function send() {
document.getElementById('myForm').submit();
}
</script>
</head>
<body>
<hr>
<b>Send sms text</b>
<br>
<br>
<form id="myForm" method=POST action="http://111.111.111.111:1111/smssend.cgi">
<table>
<tr>
<td>Destination number</td>
<td><input type=text name=num value="+39111111111"></td>
</tr>
<tr>
<td>Message text</td>
<td><textarea name=text value="My message"></textarea></td>
</tr>
<tr>
<td>Password</td>
<td><input type=text name=Pwd value="SMSxxx"></td>
</tr>
</table>
<input type=button value=Send onclick="send();">
</form>
<hr>
</body>
</html>

Related

Fckeditor to ckeditor4

Issue:
Starting off my issue is that my content does not appear for me to edit.
I can see it on my front end, but not the backend.
Likely due to the old fckedit program.
Im trying to figure out the next step to replace the old FCKeditor within my page with ckeditor4.
My site was custom built from scratch (I didn't build it). I have the ckeditor4 loaded in my include folder and I was able to test it using my URL.
However, I can't get it to work on the page or show my content that is not reachable on the backend.
Here is my page coding:
{include file='siteadmin/header.tpl'}
{include file='siteadmin/left.tpl'}
<h1>{if $action eq 'add'}Add{else}Edit{/if} Page</h1>
<form method="post" action="{$_conf_vars.ADMIN_URL}index.php?opt={$opt}&a={$action}{$qstr}" name="frm" id="frm" enctype="multipart/form-data">
{if $show_msg ne ''}
{$show_msg}
{/if}
<input type="hidden" name="page_id" id="page_id" value="{$page_id}" />
<input type="hidden" name="alias_id" id="alias_id" value="{$alias_id}" />
<input type="hidden" name="page_title" id="page_title" value="{$page_title|#StripSlash}" />
<input type="hidden" name="adapters" id="adapters" value="1" />
<input type="hidden" name="btn" value="{$action}" />
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="listdata">
<tr>
<td><div align="right">Page Title:<span class="star">*</span></div></td>
<td><input type="text" id="page_title" name="page_title" value="{$page_title|#StripSlash}" maxlength="300" style="width:532px;"/></td>
</tr>
<tr>
<td><div align="right">Page Alias:<span class="star">*</span></div></td>
<td><input type="text" name="page_alias" maxlength="100" id="page_alias" value="{$page_alias|#StripSlash}" size="60" />
<em>(a-z, 0-9, hyphen (-) only)</em></td>
</tr>
<tr>
<td valign="top"><div align="right">Description:<span class="star">*</span></div></td>
<td>
{php}
$sBasePath = $_conf_vars['ROOT_URL'].'include/fckeditor/';
$oFCKeditor = new FCKeditor('page_body') ;
$oFCKeditor->BasePath = $sBasePath ;
$oFCKeditor->ToolbarSet ="Default";
$oFCKeditor->Value = StripSlash($this->get_template_vars('page_body')) ;
$oFCKeditor->Height = 500;
$oFCKeditor->Width = 700;
$oFCKeditor->Create() ;
{/php}
</tr>
<tr>
<td width="31%"><div align="right">Meta Title:</div></td>
<td width="69%"><textarea name="meta_title" id="meta_title" rows="4" cols="100">{$meta_title|#StripSlash}</textarea></td>
</tr>
<tr>
<td><div align="right">Meta Keywords:</div></td>
<td><textarea name="meta_keywords" id="meta_keywords" rows="4" cols="100">{$meta_keywords|#StripSlash}</textarea>
<br/><small> <small>Separated by commas</small></small></td>
</tr>
<tr>
<td><div align="right">Meta Description:</div></td>
<td><textarea name="meta_desc" id="meta_desc" rows="4" cols="100">{$meta_desc|#StripSlash}</textarea></td>
</tr>
<tr>
<td width="270"> </td>
<td width="689" align="right"> {if $action eq "add" or $action eq "more"}
<button type="submit" onclick="document.frm.btn.value = 'success';">Add and Go To Listing</button>
<button type="submit" onclick="document.frm.btn.value = 'more';">Add More</button>
{else}
<button type="submit" onclick="document.frm.btn.value = 'update';">Update and Go To Listing</button>
{/if}
<button type="button" onclick="window.location.href='index.php?opt={$opt}{$qstr}'">Cancel</button></td>
</tr>
</table>
</form>
{include file='siteadmin/footer.tpl'}
Thank you,
leon

HTML TR and TD alignment

This is what I've done, but I failed to make the alignment same as next picture. Hope someone can help.
<tr>
<td > </td>
<td ><b>Type Description</b></td>
<td align="Center"><b>:</b></td>
<td colspan="3"><input name="txtCAEMGE" value="<%=server.HTMLEncode(StrCAEMDE)%>" type="text" class="NormalInputTextField" size="30" >
<input name="chkHR" type="checkbox"> Tick for disable update from HR system
</td>
</tr>
<tr>
<td > </td>
<td > </td>
<td colspan="3">
<input name="chkHR2" type="checkbox"> Tick for disable update from HR system
</td>
</tr>
I would experiment with putting both checkboxes inside a single container (e.g. a DIV). If you want to position them as a single entity then it will be easier if they are organised in the DOM this way.
e.g.
<body>
<table>
<tr>
<td><b>Type Description</b></td>
<td align="Center"><b>:</b></td>
<td>
<input type="text" value="test value" size="30" >
<div style="display: inline-block;">
<div style="display: block;"><input name="chkHR" type="checkbox"> Tick for disable update from HR system</div>
<div style="display: block;"><input name="chkHR2" type="checkbox"> Tick for disable update from HR system</div>
</div>
</td>
</tr>
</table>
</body>

How to get objec it in Kendo Grid and pass it into button in gridrow

I'm trying to put a button into grid. In order to achieve that I wanted to use rowTemplates. However I have a problem with geting and item id and put it into action parameter.
So far I tried these constructinos
<script id="rowTemplate" type="text/x-kendo-tmpl">
<tr>
<td>
<form action="/Home/EditProduct/?id="+ "#=Id#" class="addEditButton" method="post">
<submit type="button" value="Edytuj"/>
</form>
</td>
</tr>
</script>
<script id="rowTemplate" type="text/x-kendo-tmpl">
<tr>
<td>
<form action="/Home/EditProduct/?id="+ ${ Id } class="addEditButton" method="post">
<submit type="button" value="Edytuj"/>
</form>
</td>
</tr>
</script>
<script id="rowTemplate" type="text/x-kendo-tmpl">
<tr>
<td>
<form action="/Home/EditProduct/?id=${ Id }" class="addEditButton" method="post">
<submit type="button" value="Edytuj"/>
</form>
</td>
</tr>
</script>
<script id="rowTemplate" type="text/x-kendo-tmpl">
<tr>
<td>
<form action="/Home/EditProduct/?id=${ Id } class="addEditButton" method="post">
<submit type="button" value="Edytuj"/>
</form>
</td>
</tr>
</script>
However non of this method can successfully retrieve value of id parameter from object bounded to row. Is it possible to somehow pass value of id into action ??
I think this will answer your question.
http://andregelderblom.wordpress.com/2012/02/27/pass-kendoui-datagrid-variable-to-template-that-uses-zend-url/

Event delegation in Firefox after Ajax

Below is example html, script and php to submit and reload two forms via jquery ajax. In the real application, the same forms will not be reloaded but a series of forms will be loaded after each is submitted.
In chrome, IE and safari; clicking submit results in the intended ajax request. The server responds as intended. Results (showing post variables for conformation) and new forms are loaded into the page as intended. Those new forms can then be submitted and all is good.
In firefox; everything works as intended until you try to submit the forms that were loaded via ajax. They will not submit. The original forms do work. It is only the ones added via ajax that don't submit.
I am guessing that this is an "event delegation" issue with the way firefox updates the DOM after the ajax. I have read the documentation at http://api.jquery.com/on/ and other places but I am at a loss...
Any help or suggestions would be greatly appreciated! My goal is to get this functional in the latest versions of chrome, IE, safari and firefox.
html page with script
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Example Ajax Form Submit</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>
<body>
<div id="results"></div>
<div id="forms">
<div>
<table width="100%" cellspacing="0" cellpadding="0" class="ui-widget">
<form>
<tr>
<td width="100"></td><td width="300"></td><td></td>
</tr>
<tr>
<td class=""colspan="3"><h1>Form 1</h1></td>
</tr>
<tr>
<td>Input 1A</td><td colspan="2"><input type="text" name="1A" /></td>
</tr>
<tr>
<td colspan="3"><input type="hidden" name="1B" value="Form 1 was submitted" /></td>
</tr>
<tr>
<td colspan="3"><button type="submit" >Click Me!</button><input type="submit" value="Submit Form 1" /></td>
</tr>
</form>
</table>
</div>
<div>
<table width="100%" cellspacing="0" cellpadding="0" class="ui-widget">
<form>
<tr>
<td width="100"></td><td width="300"></td><td></td>
</tr>
<tr>
<td class=""colspan="3"><h1>Form 2</h1></td>
</tr>
<tr>
<td>Input 2A</td><td colspan="2"><input type="text" name="2A" /></td>
</tr>
<tr>
<td colspan="3"><input type="hidden" name="2B" value="Form 2 was submitted" /></td>
</tr>
<tr>
<td colspan="3"><input type="submit" value="Submit Form 2" /></td>
</tr>
</form>
</table>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$("#forms").on("submit", "form", function(e) {
e.preventDefault();
$.ajax({
url: "testAjax.php",
type: "POST",
cache: false,
data: $(this).serializeArray(),
success: function(jsonData) {
htmlData = jQuery.parseJSON(jsonData);
$.each(htmlData, function(id, data){
$("#"+id).html(data);
});
},
error: function(jqXHR, textStatus, errorThrown){
$("#results").html("<p>Somthing went wrong!</p>");
}
});
});
});
</script>
</body>
</html>
testAjax.php
<?php
$htmlOutput['forms'] =
'<div>
<table width="100%" cellspacing="0" cellpadding="0" class="ui-widget">
<form id="login" method="post" enctype="multipart/form-data" target="_self" action="_self">
<tr>
<td width="100"></td><td width="300"></td><td></td>
</tr>
<tr>
<td class=""colspan="3"><h1>Form 1</h1></td>
</tr>
<tr>
<td>Input 1A</td><td colspan="2"><input type="text" name="1A" /></td>
</tr>
<tr>
<td colspan="3"><input type="hidden" name="1B" value="Form 1 was submitted" /></td>
</tr>
<tr>
<td colspan="3"><button type="submit" >Click Me!</button><input type="submit" value="Submit Form 1" /></td>
</tr>
</form>
</table>
</div>
<div>
<table width="100%" cellspacing="0" cellpadding="0" class="ui-widget">
<form>
<tr>
<td width="100"></td><td width="300"></td><td></td>
</tr>
<tr>
<td class=""colspan="3"><h1>Form 2</h1></td>
</tr>
<tr>
<td>Input 2A</td><td colspan="2"><input type="text" name="2A" /></td>
</tr>
<tr>
<td colspan="3"><input type="hidden" name="2B" value="Form 2 was submitted" /></td>
</tr>
<tr>
<td colspan="3"><input type="submit" value="Submit Form 2" /></td>
</tr>
</form>
</table>
</div>';
$htmlOutput['results'] =
'<p>Form 1:<br> 1A = ' . $_POST['1A'] . '<br>1B = ' . $_POST['1B'] . '</p>' .
'<p>Form 2:<br> 2A = ' . $_POST['2A'] . '<br>2B = ' . $_POST['2B'] . '</p>';
echo json_encode($htmlOutput);
?>
Open Firebug DOM inspector and verify that your form indeed loaded. I am pretty sure you are not allowed to nest form element directly under table element, and FF is likely simply dropping it.
In general issues like this one are always due to broken HTML. Verify that your HTML is correct. Verify that loaded DOM is what you expect it to be.
Here is how your HTML is being parsed. As expected form has been mangled.

Coldfusion forms and image upload with cffile

I'm learning some Coldfusion, and I'm having trouble with this small form based application I'm building for a coworker.
Here is the first page: http://pastebin.com/aLPYHPsF
As you can see, what I want to do is get the user input and take that input and output it to html. The text stuff works fine, but I can't get the image to upload! What I want to do is have the user click upload, get a confirmation, then click submit and they are sent to the generated html (cfm) page. On the page is a resized version of the image they uploaded.
Please tell me what I'm doing wrong! Right now when "upload" is clicked, the form just dumps.
It's because of you forgot to assign enctype="multipart/form-data" to your first cfform. I've edited some of your coding. Check it out.
<cfset strPath = ExpandPath( "./" ) />
<cfset strPath = GetDirectoryFromPath(GetCurrentTemplatePath()) />
<table width="100%">
<tr>
<td align="center">
<cfform name="ecaform" action="ecagenerator.cfm" enctype="multipart/form-data">
<table style="font-family: arial; font-size: 9pt">
<tr><td height="30px" align="center" colspan="2" style="background-color: #020058; color: #FFFFFF; font-family: arial;">
<b>ECA Newsletter Creation Form</b>
</td>
</tr>
<tr><td height="20"></td></tr>
<tr>
<td>Earned from:</td>
<td>
<cfinput
type="radio"
name="earnedfrom"
value="UC">
UC
<cfinput
type="radio"
name="earnedfrom"
value="ECA">
ECA
</td>
</tr>
<tr>
<td>First Name:</td>
<td>
<cfinput
name="firstname">
</td>
</tr>
<tr>
<td>Last Name:</td>
<td>
<cfinput
name="lastname">
</td>
</tr>
<tr>
<td>Instructor's Name:</td>
<td>
<cfinput
name="instructorname">
</td>
</tr>
<tr>
<td>Date (MM/DD/YYYY):</td>
<td>
<cfinput
name="date">
</td>
</tr>
<tr>
<td>Sex:</td>
<td>
<cfinput
type="radio"
name="sex"
value="male">
Male
<cfinput
type="radio"
name="sex"
value="female">
Female
</td>
</tr>
<tr>
<td>Certificate Type:</td>
<td>
<cfinput
type="radio"
name="certtype"
value="Private">
Private
<cfinput
type="radio"
name="certtype"
value="Recreational">
Recreational
<cfinput
type="radio"
name="certtype"
value="Commercial">
Commercial
</td>
</tr>
</table>
<table style="font-family: arial; font-size: 9pt; margin-top: 20 px;">
<tr>
<td>
Upload the photo:
</td>
</tr>
<tr>
<td>
<cfif isDefined("form.fileUpload")>
<cffile action="upload"
fileField="fileUpload"
destination="#strPath#"
accept="image/*">
<cfimage action="resize"
width="200"
height="200"
source="#strPath##file.serverfile#"
destination="#strPath##file.serverfile#"
overwrite="yes">
<img src="<cfoutput>#file.serverfile#</cfoutput>">
</cfif>
</td>
</tr>
<tr>
<td>
<form enctype="multipart/form-data"
method="post">
<input type="file"
name="fileUpload" /><br /><br />
<input type="submit"
value="Submit"
action="ecagenerator.cfm" />
</form>
</td>
</tr>
</table>
<table style="margin-top: 20px;">
<tr>
<td>
<cfinput
type="submit"
name="Submit"
value="Submit">
</td>
</tr>
</table>
</cfform>
</td>
</tr>
</table>
You might want to look into using <cfdiv> for the image upload section. Basically you want the form for image uploading be inside the <cfdiv>, so that the form is submitted through ajax. Have the image form action post to a previewImage.cfm that uses <cffileupload>, validate with isImageFile() if it is an image file, then use <cfimage> to resize it and display a thumbnail (may use action="writetobrowser"). The easiest way to associate the uploaded image with the parent form would be storing the file path in Session I guess, if you don't want to code up extra Javascript.

Resources