ipad refresh the tab when clicked submit button - javascript

actually m using desktop and ipad..in desktop browser when i click on submit button the page in ipad browser should get refreshed...
suppose in desktop browser i have created a file test1.php
<input type="submit" value= "submit"/>
when i click on submit button the page in ipad should get refreshed that is refresh.php
i have tried the following code
link
this works fine in desktop browser but the same in ipad is not getting refreshed

If you are using an submit button just to refresh a page, you could use this:
<form target='test1.php'>
<input type='text' name='text1'>
<input type='button' value='submit'>
</form>
This will refresh the page, going to, lets say test1.php?text1=[whatever your text may be]
You can then use php to retrieve the value as $_GET['text1']

Related

Browser Back button should work same as Back button in my form

I'm working on a .net core web application which has multiple screens, every screen has 2 submit buttons(1 is the Back button and the other is next button) like below.
<input name="back" class="btn btn-outline-secondary mr-2" type="submit" value="Back" formnovalidate formaction="BackToIncidentInfo?tabId=#Model.TabId">
<input name="submit" class="btn btn-primary" type="submit" value="Submit">
The above Back button will act as:
When the user enters some info and click on Back button all the entered info will be saved and user will be redirected back to the previous page.
My requirement here is:
The Browser Back button should act same as Back button in the page.
Mean, when the user clicks on Form Back button Since I am using beginform and the back button type="submit" I am able to get the formfields and based on that I am saving that info.
I am not sure how to achieve this when user clicks on Browser back button.
Please help me out....
Till now I tried using window.onpopstate(), but the issue here is, it is triggering when the page loads, when user clicks on browser back and when we click browser forward...
I want to catch the exact event only when the user clicks Browser Back button...
My intention of solving this issue is:
inside the browser back event I would like to find a back button and make a click function which would achieve my task.. as below:
$('input[name="back"]').click();
So my problem here is only to detect the Browser back button event.

Disable google search input focus

I'm trying to develop chrome extension to save users favourite urls, so user will click in a button and a popup will appear infront of the website he is visiting allowing him to save his url.
The point is when this popup is been shown while user vistiing google.com, user can't write anything in the popup because google's input is automatically in focus so what should I do to disable this behavior?
Note: This is only happening with google.com
Here is example of my code which is inserted in a shadow dom in any page:
<div id="popup">
<label for="add">Add custom bookmark</label>
<input type="text" name="add" value="" id="add" autofocus="" placeholder="Please enter an URL...(www.example.com)">
Submit
Close
</div>
You can disable the "instant research" feature by clicking on "parameters" onthe bottom of google.com page and then "Research parameter".

button shows different behavior when closing a tab in plain html and in localhost (apache) after html5 required attribute was added

Good day,
I am working on a form where all my text fields have a required attribute; I have two buttons which submits the values of the text field and the other an image button that closes the tab.
It was working great and does what it is coded to but when i added html required attribute i encountered this weird behavior on my form.
Submit button does exactly what i want but the close button is not closing the tab; I had tried multiple codes to get my tab closed but it only works on html but when i set it to localhost it does not work anymore; I have listed all the things i have tried below.
Works on plain html but not when set to localhost (apache)
Original coding without required attribute.
<input name="close" value="Close" onclick="self.close()" src="../img/close.png" class="submit_button" type="image" height="28" width="28" formnovalidate>
Close ( I thought of using a hyperlink to avoid the issues with submit and button tag but would unfortunately it did not work for me )
This uses a JS confirm if it will close a tab or not
<button name="close" onclick="Exit()" type="button" formnovalidate><img src="../img/close.png" style="height: 28px; width: 28px;"></button>
My question now is why does the onclick close tab function or condition not working when the required attribute was added? Why is it having this behavior?
Any help is much appreciated; Thanks.

Android Browser crash on file input save

The Android browser crashes in a very simple scenario (I am testing on Galaxy S3, Android 4.1.2):
I have a page with a text input and a file input (you can test it here http://jsbin.com/agugit/1/)
<input type="text" name="test"/>
<br />
<br />
file<input type="file" />
If you focus the text field first, and then hit the 'next' key from the keyboard, the native file picker pops up.
Pick a file, or take a picture, and the next thing that happens is the browser freezing.
If instead you are focusing the file input dirrectly (by tapping, not by using 'next'), everything works just fine.
I have tried different workarounds but none found.
Any help or ideas?
The only solution I have found on Android is to make every file input disabled by default (so that it is skipped from tab order navigation) and listen the 'tap' event, so that when tap occurs, I focus the field programatically, so that the file picker pops up.
After the focus, and a delay of say 500 ms, make the field disabled again.
Any other ideas are still welcomed.

Is it possible to change the "Go" button onClick Event in an iPhone Web App?

I am running into a problem when trying to submit a login form. The login button works fine at calling the JavaScript code I wrote to validate the form before using the HTML for submitting my form (action="...php" method="post"). However, I don't think the submit button has actually been defined as a submit button.
The reason this is a problem is because whenever the user types in their login information all they have to do is click the "Go" button on the UIKeyboard and it redirects them to the next page without ever calling the function that validates the form. They could enter nothing and still be able to go to the next webpage.
I am relatively new to programming and this is my first time trying to write an iPhone Web App. So any help with how to redirect the go button so that it calls my JavaScript function would be great because I have no idea how to access the mobile safari keyboard.
If this isn't possible to do that then could the problem be with the go button not recognizing the login button as an actual submit button?
If you have access to the HTML code, the easiest way would be to add an onSubmit event to your form.
<form method="post" onSubmit="return YourValidationFunction()" enctype="multipart/form-data">
This would make sure the validation method is called before the form is actually submitted.

Categories