Custom template search -> on click submit form

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Piosky_to2003
User
Posts: 23

Custom template search -> on click submit form

Post by Piosky_to2003 »

in custom template search i have 3 fields
<div class="ewRow">

// 2 from with phpmaker istruction
<span class="ewCell">{{{Year}}}</span>
<span class="ewCell">{{{Month}}}</span>

// AND ONE MYFIELD RADIO BUTTON
<span class="ewCell">
<?
$AllMonth=$_GET["AllMonth"];
echo "<span class='ewCell'>All Month</span>";
if ($AllMonth==0)
{
echo "<span class='ewCell'>No <input onClick='document.forms[0].submit();' type='radio' id='AllMonth' name='AllMonth' value='0' checked=checked /></span>";
echo "<span class='ewCell'>Yes <input onClick='document.forms[0].submit();' type='radio' id='AllMonth' name='AllMonth' value='1' /></span>";
}
else
{
echo "<span class='ewCell'>No <input onClick='document.forms[0].submit();' type='radio' id='AllMonth' name='TuttiMesi' value='0' /></span>";
echo "<span class='ewCell'>Yes <input onClick='document.forms[0].submit();' type='radio' id='AllMonth' name='TuttiMesi' value='1' checked=checked /></span>";
}
?>
</span>
</div>

with myField RADIO BUTTN "ALL MONTH" i put onClick='document.forms[0].submit();' AND IS WORK
WHEN YOU CLICK on the radio button THE FORM SUBMIT WITHOUT CLICH ON PHMKAER SEARCH BUTTON

how i do to put the same function for the two field insert with phpmaker istruction

<span class="ewCell">{{{Year}}}</span>
<span class="ewCell">{{{Month}}}</span>

i want that also if i click on the fieds year and month the form is update without click on search button
'document.forms[0].submit();

thks for your help
silvio


mobhar
User
Posts: 11660

Post by mobhar »

You may simply use jQuery code to trigger the form submit based on click/change of Year and Month field, and put it in "Startup Script" under "Client Scripts" -> "Table-Specific" -> "List Page".

In addition, make sure also you have already defined the id of those element/fields in your Custom Template Search section.


Piosky_to2003
User
Posts: 23

Post by Piosky_to2003 »

Thks a lot. it's work.
For phpmaker's users:

For all the fields in which I want Auto Submit Form without click on search
I put in Cliente Script/List Page/Startup Script

$( "#x_ContactID" ).on( "change", function() {this.form.submit();});
$( "#x_SupplierID" ).on( "change", function() {this.form.submit();});


Post Reply