Joomla module form to submit to same page - joomla

I have a Joomla module in an article. The module has a form, and when I submit the form I want it to reload the same page (and some PHP will take care of the form's new state).
Is there any way to do this with a module, without using ajax? Because at the moment Joomla throws a 404 and I can't figure out where the form is trying to submit to.
Let's say my page is http://www.example.com/payment
The form submits to http://www.example.com/404
This is my form:
<form method="post">
<label>Order ID</label>
<input type="text" name="id" value="<?php echo $_POST['id']; ?>" />
<label>Email</label>
<input type="text" name="email" value="<?php echo $_POST['email']; ?>" />
<input type="submit" name="login" value="Continue" />
</form>
I have tried having no form action, as well as:
action="index.php?option=com_content&view=article&id=8"
action="/index.php?option=com_content&view=article&id=8"
action="payment"
action="/payment"
It always submits to 404.

The problem may be with submiting id via input, because Joomla uses id internally to find the correct route, so if you overwrite it with your request, Joomla will try to get article/category with unexisting id.
So, try to rename the name of the input with id and see what happens.

Related

Email subscription form in octobercms

I am using Email Subscription Form plugin. When I enter the email address in the form and click the submit button, the submitted email appears in the url and it redirects to the same page. I did the configuration as mentioned in the documentation but it is not working. Neither the subscription list is updated nor it shows the userProfile page.
<form name="form-subscribe-andradedev" id="form-subscribe-andradedev" data-request="formSubscribe::onAddSubscriber" data-request-update="'formSubscribe::alert': '#result'">
<input type="email" class="form-control" name="email" placeholder="* Email" required>
<input type="hidden" name="latitude" id="latitude">
<input type="hidden" name="longitude" id="longitude">
</form>
Reads like you need {% frameworks extras %} loading in the template somewhere. You also need the jquery loaded before that.

Sagepay 3D Secure redirecting to acs url returns a blank page

Redirecting to the below url (with CRM webform step )is returning a blank page. Any solutions?
Thanks in Advance
https://test.sagepay.com/mpitools/accesscontroler?action=eJxVUttuwjAMfd9XVHxA04ReKDJBBbStmtiqMW17jVKPVusF0naUv18CZYw8+Rw7J/ZxYN6XhfWDqsnrajaitjOa8zt4yxTiaoOyU8hhjU0jtmjl6WzEHOr5rkvHzJ14XkiZx8YjDkn0insOgxDXOjYFcoFaQclMVC0HIfeL+Jm7IQsdB8gAoUQVr3jgMjcMqDMcIGcaKlEiXwqFy7qrZF581epDFNgAOWVAarpVRz5hPpALgE4VPGvb3ZSQw+FgS3kwd+xabe3uG4hJA7l2lnQmarRcn6c88WV9T/1sUX0+Rfu+E+OXh/6dreNFNANiKiAVLXLtR+gELLSoP6Xu1JkAOfEgStMH95zgNOcZwc48Et2k/lOgDVdYycsoFwTY7+oKdQUD8hdDio3kG7OaRBytdRLrxw0F5DrM8tGYLlvtIzV+nyKjl2uPdPdnQQOAmFoyrJIMW9fRzW/4BYe1tvY=
Expected: 3D Secure page of the respective bank should be loaded
You need to be automatically POSTing a form - not have URL variables.
`<form name="form" id="3dsecureform" action="https://test.sagepay.com/mpitools/accesscontroler?action=pareq" method="post">
<input type="hidden" name="MD" value="[MD]" />
<input type="hidden" name="PaReq" value="[PaReq]" />
<input type="hidden" name="TermUrl" value="[TermUrl]" />
<button type="submit btn btn-primary">Submit</button>
</form>`

Passing input to url with get method in form in laravel 5.1

I want to pass my search input to laravel 5.1 like this
localhost:8000/search/{searchtext}
but right now it send data with this method
localhost:8000/search?search='searchtext'
<form action="search" method="get" class="form-wrapper">
<input type="text" NAME="query" id="search" placeholder="جستجو ..." required>
{{--<input type="hidden" name="_token" value="{!! csrf_token() !!}">--}}
<input type="submit" value="بررسی" id="submit">
</form>
Can you give me a solution for it?
Change the action attribute of the form in the onSubmit event, you have to use javascript. The exact code depends if you are using a library like jQuery or plain Javascript.
Here a useful link:
Change form action based on submit button

Changing a text file from a HTML form

I'm just wondering if there's any way I can change the data held in my text file by filling out a HTML form on my website.
I've used AJAX to read to the website before but I don't know if its possible the other way round..
Ok so I don't really have any code yet cause I'm not sure how to do it.. but essentially, I want this HTML form:
<form name="updateGallery">
<b>Image:</b> <input type="image" name="image"/><br>
<b>Name:</b> <input type="text" name="name"/><br>
<b>Description and Price:</b> <input type="text" name="desPrice"/><br><br>
<input id="start" type="submit" onclick="submit" value="Update"/>
<input id="start" type="reset" value="Cancel"/>
</form>
to read to a text file I have set up containing information on items including - the name, an image of the item, description and price.

Honeypot protection with Ajax

Recently i got attacked by nasty auto-form fill bots which filled my shout form with all sorts of spam. My shout form consist from a html file with 2 textboxes,an ajax script(for refreshing without reloading) and my php file for handling all the inserting data into my DB.
I am thinking implementing a hidden textbox for a minimum protection against these bots but with no luck since i cant pass the honeypot data to my php file. My code:
HTML Form
<form class="form" method="post" action="postdata.php">
<fieldset id="inputs">
<input id="name" name="name" type="text" placeholder="name" maxlength="20">
<textarea id="message" name="message" type="text" placeholder="message" maxlength="255"></textarea>
</fieldset>
<fieldset id="actions">
<input type="submit" id="submit" value="Submit">
</fieldset>
</form>
Ajax script
$(function(){refresh_shoutbox();$("#submit").click(function(){var a=$("#name").val();var b=$("#message").val();var c="name="+a+"&message="+b;$.ajax({type:"POST",url:"postdata.php",data:c,success:function(d){$("#shout").html(d);$("#message").val("");$("#name").val("")}});return false})});
function refresh_shoutbox(){var a="refresh=1";$.ajax({type:"POST",headers:{"cache-control":"no-cache"},url:"postdata.php",data:a,success:function(b){$("#shout").html(b)}})};
postdata.php file
<?php
if($_POST['name'] or $_POST['message']) {
$name= $_POST['name'];
$message= $_POST['message'];
///do other stuff/////
?>
I will insert a hidden field in my html form
<input id="email" name="emails" style="display:none"></br>
but i cant manage to pass the extra value to my existing ajax script.Tried some code but with no luck.
Any help so i can get my shoutbox up and running again?

Resources