Form in JQTouch - jqtouch

I have tried jqtouch and I have trouble getting a form with php to work in Safari. Nothing happens when I press submit in Safari but It works in Explorer. I tried to change input type from submit to button but it didn't help. How should I change my code?
<?php
function test1()
{
if (isset($_POST['submit'])){
$test = $_POST['test'];
echo $test;
}
}
?>
<form action="#" method="post" class="form">
<table>
<br />
<tr>
<td><label for="test">Test:</label></td>
</tr>
<tr>
<td><input type="text" name="test"></td>
</tr>
<tr>
<td><br /><input type="submit" name="submit" class="submit" value="Press"></td>
</tr>
</table>
</form>

Related

I have this code, when submited the form dont refresh, someone know how refresh after submit on october cms?

<form data-request="onSend" data-request-update="'{{ __SELF__}}::attbanco': '#banco' "
data-request-flash >
<table>
<tr>
<td>Nome: </td> <td ><input type="text" id="nome" name="nome"></td>
</tr>
<tr>
<td>Idade: </td> <td ><input type="number" id="idade" name="idade" value="{{usuario.idade}}"></td>
</tr>
<tr>
<td>Telefone: </td> <td ><input type="text" id="telefone" name="telefone" value="{{usuario.telefone}}"></td>
</tr>
</table>
<button type="submit" >Enviar</button>
<input type="hidden" value="{{usuario.id}}" name="id">
this code work, saves the values on database, but i need manually refresh page to see the result on my
screen, someone know how refresh after submit?
Please, explain most simple possible, i am newbie
The best way to do what you want is to put the form in a partial and update it when the form is submitted.
Replace your form with this:
<div id="specialForm">
{% partial __SELF__~"::specialForm" %}
</div>
Create a partial to describe the form; I used specialForm. It should reload the form and clear the content.
<form data-request="onSend" data-request-update="'{{ __SELF__}}::attbanco': '#banco', '{{ __SELF__ }}::specialForm': '#specialForm' "
data-request-flash >
<table>
<tr>
<td>Nome: </td> <td ><input type="text" id="nome" name="nome"></td>
</tr>
<tr>
<td>Idade: </td> <td ><input type="number" id="idade" name="idade" value="{{usuario.idade}}"></td>
</tr>
<tr>
<td>Telefone: </td> <td ><input type="text" id="telefone" name="telefone" value="{{usuario.telefone}}"></td>
</tr>
</table>
<button type="submit" >Enviar</button>
<input type="hidden" value="{{usuario.id}}" name="id">
</form>

I'd like to submit a HTML Service Form in GoogleScript

I have a form created in the HTML-Service of GoogleScript.
I'd like the user to input some values in this form.
After that I'd like the user to press the submit button and "work" with the user-input.
My question now is how I can get on the user-input the user put into the form in the HTMLService Pop Up Window.
I already added the and also added a submit-button to this form.
But when I click on this nothing happens.
Here is the code of the html:
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<script>
function formSubmit() {
google.script.run.Wertezeigen(document.forms[0]);
}
</script>
<body>
<p>Dieses Formular erzeugt ein neues Triage Dokument und speichert es mit den eingegebenen Werten in xyz ab.</p>
<form id="Triage_Template">
<table style="undefined;table-layout: fixed; width: 460px">
<colgroup>
<col style="width: 110px">
<col style="width: 350px">
</colgroup>
<tr>
<td>Gebäude:</td>
<td><input type="text" name="gebaude"></td>
</tr>
<tr>
<td>Prozessbereich:</td>
<td><input type="text" name="prozessbereich"></td>
</tr>
<tr>
<td>Straße:</td>
<td><input type="text" name="straße"></td>
</tr>
<tr>
<td>Objekt:</td>
<td><input type="text" name="objekt"></td>
</tr>
<tr>
<td>Defekt:</td>
<td><input type="text" name="defekt"></td>
</tr>
</table><br>
<input type="button" onClick="formSubmit()" value="Submit" />
</form>
</body>
</html>
Function in Code.gs:
function Wertezeigen(form) {
var vorname_test = form.gebaude;
alert(vorname_test);
}
What I'm trying right now is quite simple:
I want to show the input of the input-box "gebaude" in the form as an alert when the user clicks on submit.
You need to give each form input a unique ID:
<input type="text" name="gebaude" id="gebaude">
Since you're trying to show this in your HTML page once you've clicked submit, use return instead of alert:
return form.gebaude;
Change your form submit button to the following code:
<input type="submit" id="submit" value="Submit"
onclick="this.value='Submitting...';
google.script.run.withSuccessHandler(formSubmitted)
.Wertezeigen(this.parentNode);
return false;">
</form>
<div id="output"></div>
Then include this script just before the end of your HTML code:
<script>
function formSubmitted(status) {
document.getElementById('Triage_Template').style.display = 'none';
document.getElementById('output').innerHTML = status;
}
</script>

How to show content in a fancybox?

I'm trying to show a form inside a fancybox but i can't get it to show something.
I dont get how this fancybox works.
My code looks like this:
Show Fancybox
<div id="divForm" >
<form action="code_eingabe.php" method="post">
<table >
<tr>
<td colspan="2"><h1>E575 - Gewinnspiel</h1></td>
</tr>
<tr>
<td colspan="2"><?php if(isset($text)){echo $text;} ?></td>
</tr>
<tr>
<td><input type="text" name="code"/></td>
<td><input type="submit" name="submit" value="submit!"/></td>
</tr>
</table>
</form>
</div>
You have to wrap your content with a div that has display: none
<div id="divForm" style="display: none">
<-- put your content here -->
</div>
EDIT
to pop up : see this sample of a popped up fancybox content when register :
$("#Register").click(function() {
if($(this).is(':checked')) {
alert("This is a fancybox! Register here.")
$('#CheckoutOptions').fancybox('');
}
})

Form doesn't submit on Firefox

<table width=100% cellspacing=0 cellpadding=0 class="form_table">
<form name="suggestion_box" action="suggestion_box.php" method=post>
<input type="hidden" name="form_submit" value="1">
<tr>
<td width=40% align=right valign=top class="form_label_cell">
<b class="form_label">
First Name<br>
</b>
</td>
</table>
<br>
<input type="image" src="button_submit.gif" alt="Submit" class="input_gfx">
<input type="hidden" name="form_submit" value="1">
<br>
</form>
</table>
This is my form, I don't know why that doesn't work with Firefox, can you help me?
I've been reading hundreds of answers since weeks ago, but I couldn't make it work.
1) You can't place your form within the table like that.
2) You are closing your table (</table>) twice.
3) You never closed your row (</tr>).
Try this simplified code instead:
<form name="suggestion_box" action="suggestion_box.php" method=post>
<table width="100%" cellspacing="0" cellpadding="0" class="form_table">
<tr>
<td>
<input type="hidden" name="form_submit" value="1">
</td>
</tr>
<tr>
<td>
<b class="form_label">
First Name
</b>
</td>
</tr>
<tr>
<td>
<input type="submit" src="button_submit.gif" alt="Submit" class="input_gfx">
</td>
</tr>
</table>
</form>
You have to specify a name for your image input field.
<input type="image" name="yourimage" src="button_submit.gif" alt="Submit" class="input_gfx">
You can access the x/y values using the POST variables yourimage.x / yourimage.y (or in PHP yourimage_x, yourimage_y).
I have had problem with forms and inputs which don't have id's, Try giving id's to the form and form elements and add type="submit" to your submit button.

How to find tag in table structure using jQuery

I have the following html:
<table>
<tr>
<td>
<input type="button" id="btnAdd" value="Add" />
<input type="hidden" id="hdnID" value='209' class="hdn" />
</td>
</tr>
<tr>
<td>
<input type="button" id="btnAdd" value="Add" />
<input type="hidden" id="hdnID" value='210' class="hdn" />
</td>
</tr>
<tr>
<td>
<input type="button" id="btnAdd" value="Add" />
<input type="hidden" id="hdnID" value='211' class="hdn" />
</td>
</tr>
</table>
I have a jQuery click event for the add buttons.
$("#btnAdd").click(function ($e) {
// Need selector here that can find the hidden field (see above) that is found
// in the same td as the button that was clicked. For example, if the Add button
// in the 2nd row was clicked then I need to find the hidden input that has
// the value of '210'.
// Doesn't work... not sure why
var hdn = $(this).siblings().next();
});
Thanks in advance for helping me through a thick moment...
Maybe something like this would work?
("#btnAdd").click(function ($e) {
var hdn = $(this).parent().next().children('td input');
});