How to edit a table cell using a form - javascript

Hello I would really love to use some help here, I have this homework where i need to click on add,edit, delete buttons on a table: I GOT THE ADD AND DELETE ONES FIGURED OUT.But i'm stuck on the edit one, so I have to click on the edit button in the last cell the edit button would display a form in that form the cell information should appear and i need to be able to mofidy them. here is the html code of the form:
<!--edit form-->
<form id="editform" style="display: none;">
<fieldset>
<legend>Informations du joueur</legend>
<label>Nom: <input name="Name" /></label>
<label>
Palmares :
<textarea name="address" cols="30" rows="3"></textarea>
</label>
<input type="button" value="Soumettre" onclick="Soumettre2()">
<input type="button" value="Annuler" onclick="Cancel()" >
</fieldset>
</form>
the first button ( Soumetter2 () function ) is where i have the problem, i didnt share the table html because it has a lot of information in it but its just a basic html table. Thanks for any help in advance
I tried some google ressources but nothing like I want. i shouldnt use jquery

Related

How to submit data to another form?

I have one form on one page and another on another website. How do i submit the data filled out on the first form to the other?
This is the code i have.
<form action="/action_page.php" method="get">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
Comments: <input type="text" name="comments"><br>
<button type="submit">Submit</button><br>
<button type="submit" formaction="http://www.example.com/formresult.asp")>Submit to another Form</button>
</form>
Ok so i want my users to fill out one form, but have the option to send to another form.
The reason i need this because i have different HELP DESK support teams. INSTEAD of a number of different contact forms on a lot of html pages in my directory, i want to just have the option to send to anyone of my HELP DESK support team from one form. ALL THE FORMS are the same, the PHP files are the same. The EMAIL addresses are the only thing different for each team member.
The OPTION to send to a URL is also helpful. I read it is called 'An absolute URL ' and 'A relative URL' as Attribute Values, but i think i am coding it wrong, it will not work for me.
type="submit" formaction="http://www.example.com/form.php")>Submit to another Form
If i can get some help by an example on the code i will need to do both of these actions - i can start to test my new gaming clan website live.
Thanks in advance
Please advise
Try this you have to change the attributes for action tag on each button click. I have change submit type in to button and placed a hidden input type as submit. hope this help you to move on.
<form action="/action_page.php" method="get" id="myForm">
First name:
<input type="text" name="fname">
<br>
Last name:
<input type="text" name="lname">
<br>
Comments:
<input type="text" name="comments">
<br>
<input type="submit" name="sub" id="sub" style="display:none;">
<button type="button" onClick="javascript:document.getElementById('myForm').setAttribute('action','action_page.php'); javascript:document.getElementById('sub').click();">Submit</button>
<br>
<button type="button" onClick="javascript:document.getElementById('myForm').setAttribute('action','http://www.example.com/formresult.asp'); javascript:document.getElementById('sub').click();">Submit to another Form</button>
<br>
</form>
I think your problem is in the
<form action="/action_page.php" method="get">
You should target it to your php like this:
<form action="/http://www.example.com/formresult.asp" method="get">
Then on the receiver file you should type the handling of the results

How to reset the form data in html using jquery/javascript && and also how to send the form data to an email using jquery?

I'm new to jquery
I'm working on a form data html,
now i need to reset the data on click on the reset button and also need to transfer the form data to email on click on submit button.
Can anyone help me in solving this??
Before Posting the question I have gone through the link which Pierre C. has updated and my question is different from that question and even how to add /can we add "type" attribute in anchor tag.??
here is the html:
<form id="form" method="post">
<fieldset>
<label>
<input type="text" value="Name">
</label>
<label>
<input type="text" value="Email">
</label>
<label>
<input type="text" value="Phone">
</label>
<label>
<textarea>Message</textarea>
</label>
<div class="btns">
Clear
Send
</div>
</fieldset>
</form>
To clear all the data within a form, all you have to do is add an
<input type="reset" name="reset" value="Reset"></input>
However, reset buttons are annoying and no one ever uses them, so I suggest you just leave that. With regards to sending the form, the way I would do it is write this app in ASP.NET MVC and just put the mail logic in the controller, or create an API for your app, then create an Ajax POST on the button click using the form data as API parameters.

Complete an url wtih the data given in boxes and go to that url

My workmates and I use the link below a couple of times in a day by clicking several pages to finally get this link:
http://eharita.mamak.bel.tr/imararsiv/test.aspx?f_ada=36391&f_parsel=4
What i want to do is, after test.aspx?_ada= you see 36391 this is my first number and &f_parsel= 4 this is the second one.
I want to create an HTML which consist of 2 boxes and a submit, sent button, in the very first box i want to write down a number (in the example it is : 36391) and in the second box another number (in the example it is : 4) and after that i ll click on Submit or Send button and this action will take me to the URL of
http://eharita.mamak.bel.tr/imararsiv/test.aspx?f_ada=36391&f_parsel=4
Maybe its easy or not but as a civil engineer i don't know how to make an HTML page like that.
It is quite easy, you just need a basic form.
<form action="http://eharita.mamak.bel.tr/imararsiv/test.aspx" method="GET">
<input type="text" name="f_ada" > <br>
<input type="text" name="f_parsel"> <br>
<button type="submit"> Submit</button>
</form>
You can try it out here http://jsfiddle.net/ea6heach/
<form action="http://eharita.mamak.bel.tr/imararsiv/test.aspx">
<input type="text" name="f_ada"/><br>
<input type="text" name="f_parcel"/><br>
<input type="submit" name="submit"/>
</form>
The demo doesn't work because Stackoverflow doesn't allow HTML redirecting but this is the idea of a simple form.
Following form write in particular html file.
<form action="action_page.php">
First number<br>
<input type="text" name="first_val" >
<br>
Second number<br>
<input type="text" name="second_val">
<br><br>
<input type="submit" value="Submit">
</form>
//following code write in the 'action_page.php' file.
<?php
//in the action_page.php file write following code
if(isset($_GET['first_val']) && isset($_GET['second_val'])
{
?f_ada=36391&f_parsel=4
$url = 'http://eharita.mamak.bel.tr/imararsiv/test.aspx/';
$url .= '?f_ada='.$_GET['first_val']&f_parsel['second_val'];
header('Location: $url);
}
?>

Getting data from generated form in jquery

I have the following code setup:
http://jsfiddle.net/bABHU/2/
Had to change it a little bit to get it all on jsfiddle but the problem i'm having is the data from the first from gets put into the query string to send off to the ajax call, but the form elements generated after that (which comes from a JSON call) don't get submitted when clicking the next button again.
So when you get to the second question how can I submit the 'answer' input that was generated. - see the console for the outputs.
Hope that makes sense.
Any help is appreciated.
Thanks.
This is happening because you are replacing your entire <form> element with the new HTML content from question 2. Replace $('.FinderOptionsInner').html with $('#formStep').html
See http://jsfiddle.net/M3eZp/1/
When you replace the markup for findOptionsInner, you obliterate the form itself. Hence it not serializing. Also, you have no close tag for your form.
<form action="" method="post" name="formStep" id="formStep">
<div class="FinderOptionsInner">
<p>
<label class="label_check">
<input type="radio" name="answer" value="1" id="answer_0" />
Answer 1</label>
<br />
<label class="label_check">
<input type="radio" name="answer" value="2" id="answer_1" />
Answer 2</label>
<br />
</p>
</div>
</form>
<div class="nextButton-step1 nextButton">Next
</div>
Works just fine (notice that I've also fixed the close tags for form and the div at the bottom).

want my form's values to show in another div after clicking submit

I have a ticket form and when they click buy, I would like it to be saved and shown in another div as "user's ticket information" plus they are also able to buy a new ticket and add to the old one after. It doesn't have to be saved in a database or anything, for example when you click refresh all info would go away and you can start from fresh. Another example of how I do it is when I sign up, the user information will go to my memory class. Any javascript/jquery/html will help. Bellow is a start of what im working at. Thanks ^^
<html>
<body>
<form id="buyTicket" action="" method="POST">
<div id="ticketHeader">Buy Your ticket here</div><br></br>
<div>Number of persons :<input type="number" required id="numberOP" value="" placeholder="number of persons"/></div>
<div>Flight Destination:<input type="text" required id="destination" value="" placeholder="hawaii/thailand/spain"/></div>
<div>Depature :<input type="text" required id="depature" class="datepicker" value="" placeholder="enter depature date"/></div>
<div>Return :<input type="text" required id="return" class="datepicker" value="" placeholder="enter return date"/></div>
<div><button type="submit" class="button" id="buttonTicket">Buy Ticket</button></div>
</form>
</body>
</html>
Like ben said use .val() http://api.jquery.com/val/ to get the values. Here is a working example http://jsfiddle.net/YNez9/
You will have the div, which shows the selected values floating to the right
<div id="result" style="float:right;">
</div>
and on submit you want to add the values entered\ or have a placeholder that you can set its value then make it visible
$('#buyTicket').submit(function() {
$('#result').append('<div>Number of persons :'+$('#numberOP').val()+'</div>');
//.....
//return false;
});​
You can use the val() function to get the values from the form once the button is clicked. Api documentation available here: http://api.jquery.com/val/. Perhaps in something a bit like this:
$('#buttonTicket').click(function() {
$('#ticketinfoheader').text($('#numberOfPersons').val());
});

Categories