simon551 Posted May 7, 2007 Share Posted May 7, 2007 < noobian to php and web programming in general > Is there a way to 'submit' a form on lost focus? This is my code, generated in Dreamweaver: <form action="<?php echo $editFormAction; ?>" method="post" name="erDets" id="erDets"> <table align="center"> <tr valign="baseline"> <td nowrap align="right">Date of Charge:</td> <td><input type="text" name="fdate" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Vendor:</td> <td><input type="text" name="vendor" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right">Description:</td> <td><input type="text" name="description" value="" size="32"></td> </tr> <tr valign="baseline"> <td nowrap align="right"> </td> <td><input type="submit" value="Insert record"></td> </tr> </table> <input type="hidden" name="erID" value="<?php echo((isset($_COOKIE["ERID"]))?$_COOKIE["ERID"]:"") ?>"> <input type="hidden" name="MM_insert" value="form1"> </form> Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/50391-solved-submit-on-lost-focus/ Share on other sites More sharing options...
neel_basu Posted May 7, 2007 Share Posted May 7, 2007 You need to use AJAX or javascript here. PHP cant work on Cliant side Quote Link to comment https://forums.phpfreaks.com/topic/50391-solved-submit-on-lost-focus/#findComment-247482 Share on other sites More sharing options...
sasa Posted May 7, 2007 Share Posted May 7, 2007 are you look something like this <input type="text" onblur="this.value='sasa'" value="On lost focus I set my value"> Quote Link to comment https://forums.phpfreaks.com/topic/50391-solved-submit-on-lost-focus/#findComment-247494 Share on other sites More sharing options...
simon551 Posted May 7, 2007 Author Share Posted May 7, 2007 are you look something like this <input type="text" onblur="this.value='sasa'" value="On lost focus I set my value"> I'm not sure what you mean, sorry. Perhaps I need to move to the javascript forum... Quote Link to comment https://forums.phpfreaks.com/topic/50391-solved-submit-on-lost-focus/#findComment-247593 Share on other sites More sharing options...
simon551 Posted May 7, 2007 Author Share Posted May 7, 2007 Maybe I should start over. This post began in the php help forum and was kicked over here. What I am trying to accomplish doesn't seem totally unique so it very likely the way I am asking the question which is keeping me from finding the answer. This is an expense report problem. I have 3 tables that make up an expense report: expensereport, erDets, and erSplits. The reason for the 3rd table is that in some cases the employee will need to split an expense into multiple lines due to multiple projects being covered by one expense item. What I want to do is create an interface that makes it seem like the user is entering into just 2 tables (expensereport, details) so the need I have is to combine the 2 tables (erDets, erSplits) into one form -- or at least the appearance of one form. My first thought is to have one form submit without any notice to the user. Then I would pull back the key id and use it in the next form before finally submitting. Another idea is to have just one button that submits both forms. Could I make a button that when clicked would do the following (feel free to boot me back to the php forum, moderator): 1. query one: insert into erDets (form1) 2. retrieve the newly created key ($var = mysql_insert_id() 3. query two: insert into erSplits ($var, form2) Quote Link to comment https://forums.phpfreaks.com/topic/50391-solved-submit-on-lost-focus/#findComment-247634 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.