- Screen name: pampas
- About Me: Full time VP Operations, part time web designer, learning php and now jquery to supplement what I want to create.
pampas's Profile
4 Posts
4 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- In a recent previous post (here ) I wanted to know how to update an "input" field using jQuery by first finding it in the row that was dragged and dropped into place - so that the sequence was recorded properly.
I thought I could than hit Submit and $_post the information to the database as normal. However, I found that I could not. In fact the "LAST" item I moved never recorded the information and I had two records with the exact same sequence.
I tried it moving it to the first position, to a position somewhere in the middle, or at the end. In every case it acted as though the value was never stored.
My question (based on this JSFiddle ) is how do I make sure all the values I input with (":input").val(count) where count is the sequential counter are actually available in the DOM for the HTML submit function will $_post the newest values instead of the old value?
Can you help me?
Thanks in Advance.
- I created a JSFiddle to help explain the change I wish to make.
- <tr>
-
<td class='priority'>
-
<input name="sequence" value="1"
size="6" />
- </td>
-
<!--Added INPUT field in the td class priority-->
-
-
<td>George Washington</td>
- <td>Apple</td>
- <td>N</td>
- <td><a class='btn btn-delete btn-danger'>Delete</a>
- </td>
This would be generated from a php call to a database that is currently working well.
At the end of the drag and drop I'm trying to re-number the value of the sequence in the input field.
The original example was easier because it used the <td> element and used the HTML handler to replace it with the new number.
- $(this).find('.priority').html(count);
I'm trying to replace that line to find the "sequence" and replace the value with the new "count".
Can you help me?
Thanks in advance for your help.
- 16-Jul-2011 03:37 PM
- Forum: Using jQuery
Good Afternoon,
I have a problem created by my complete [rookie] status – only second time venturing into jQuery.
I created a simple shopping cart using php and the PayPal buttons (1: buy now, 2: add to cart). The php back end does it great, it generates the table and the buttons and everything works just like it’s supposed to; Except, I forgot to add sizes.
So I found out what I need to add, and I realize that the way the buttons work, I will have two different text boxes for size. Not very visually appealing, and since I’m not submitting this to the server before it goes to PayPal to pay, I cannot modify it with php the way I normally would. jQuery / javascript are my only hope of making this work.
What I want to do:
1) Have a single textbox where [size] is entered by the user.
2) Copy the value from the [correct] text box to the Value=”” section of the now hidden field in the PayPal form
That way, no matter whether they [BUY NOW] or [ADD to CART] the right size is submitted to the PayPal shopping cart.
This is the actual PayPal code that I’m trying to change- <table>
- <tr>
- <td><input type="hidden" name="on1" value="Size" maxlength="200">Size</td>
- <td><input type="text" name="os1" value="jQuery To Fill This Value" size="6"></td>
- </tr>
- </table>
- <table>
- <tr>
- <td>
- <p>input<br/>
- <input type="text" size="10" id="js_input" /><br />
- output<br />
- <input type="text" size="10" id="js_output"/></p>
- <input name="js_button" type="button" value="Copy Test" id="js_button" />
- </td>
- </tr>
- </table>
- <p id="display"></p>
- <script type="text/javascript">
- $(function(){
- $('#js_button').click(function(){
- var enteredVALUE = $("#js_input").val();
- //console.log(enteredVALUE)
- $('#display').html("<b>Value Typed:</b>" + enteredVALUE)});
- });
- </script>
In the immortal words of John Kennedy, give the man a fish, feed him for a day, teach him how to fish – and he’ll need beer too.Can you point me in the right direction?
Thanks in advance,
Paul- 17-Apr-2011 04:13 PM
- Forum: Getting Started
Greetings to all,
I’m a complete newbie to jquery. I started out of GREAT necessity as I’m writing a meal plan function where I want to post a particular food to “my favorites” and found that while PHP is truly powerful, it has one limitation – I have to send things to the server to process them (yes, that was my attempt at humor).
I wrote my first jquery driven $.post that calls a PHP page, that actually does the store for me. This works great. However, the “ignorance” I’m hoping someone will cure from me comes from the fact that my button, only posts the “first” row of information.
The table I generate from a search for foods. It lists all the foods that match the description. Then I added, like I do in PHP a form button to Post the data from that row to my Favorite’s table. However, this does not work with the way I wrote my function.
The function I wrote is this:
- <script type="text/javascript" src="js/jquery-1.5.2.min.js"></script>
- <script type="text/javascript">
- function fav_store() {
- $('#stored').hide();
- $.post('meal_fav_post.php', {
- NDB_No: $('form[name=favorites] input[name=NDB_No]').val(),
- user_id: $('form[name=favorites] input[name=user_id]').val(),
- MM_insert: $('form[name=favorites] input[name=MM_insert]').val()
- },
- function(result) {
- $('#stored').html(result).show();
- });
- }
- </script>
The button is part of a DO WHILE loop in PHP and here’s the code:
- <?php do { ?>
- <tr>
- //lots of stuff here then
- <td>
- <form name="favorites" id="fav_form">
- <input type="hidden" name="NDB_No" value="<?php echo $row_test_food_selection['NDB_No']; ?>" />
- <input type="hidden" name="user_id" value="1" /> (Note user_id = 1 for testing only)
- <input type="hidden" name="MM_insert" value="form1" />
- <input type="button" value="Add To Favorites" onclick="fav_store();" />
- </form>
- <div id="stored">This is where I want to display my results</div>
- </td>
- </tr>
- <?php } while ($row_test_food_selection = mysql_fetch_assoc($test_food_selection)); ?>
Please forgive my ignorance, but before I started looking for tutorials on this, I drank java, not programmed in it, so this is really new to me.
Thanks in advance to anyone with the patience to teach me how to fix this.
Paul
- «Prev
- Next »
- <tr>
Moderate user : pampas
© 2013 jQuery Foundation
Sponsored by and others.

