Closed Thread Icon

Topic awaiting preservation: help me please (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=31882" title="Pages that link to Topic awaiting preservation: help me please (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: help me please <span class="small">(Page 1 of 1)</span>\

 
tomeaglescz
Paranoid (IV) Inmate

From: Czech Republic via Bristol UK
Insane since: Feb 2002

posted posted 06-22-2010 00:14

bah humbug even with the code tags this gets screwed up in formatting

code:
&lt;form method=&quot;POST&quot; action=&quot;&lt;?php echo $editFormAction; ?&gt;&quot; name=&quot;single_payment&quot; target=&quot;_self&quot; id=&quot;single_payment&quot;&gt;
        &lt;p&gt;Select Payment Type below:&lt;/p&gt;
        &lt;p&gt;One time payment&lt;/p&gt;
        &lt;p&gt;Cost:&lt;input name=&quot;amount&quot; type=&quot;text&quot; id=&quot;amount&quot; value=&quot;&lt;?php echo $row_Recordset3[&#039;course_cost&#039;]; ?&gt;&quot; readonly=&quot;true&quot; /&gt;
          &lt;label for=&quot;one_time_payment&quot;&gt;&lt;/label&gt;
          &lt;input name=&quot;date_due&quot; type=&quot;hidden&quot; id=&quot;date_due&quot; value=&quot;&lt;?php echo $row_Recordset3[&#039;date_to_limit&#039;]; ?&gt;&quot; /&gt;
          &lt;input name=&quot;payment_reason&quot; type=&quot;hidden&quot; id=&quot;payment_reason&quot; value=&quot;&lt;?php echo $row_Recordset4[&#039;course_type&#039;]; ?&gt;&quot; /&gt;
        &lt;/p&gt;
        &lt;p&gt;Student paying now? 
&lt;script type=&quot;text/javascript&quot;&gt;
function check_paid() {
var form = document.getElementById(&quot;payment_recieved&quot;);
var date_recieved = document.getElementById(&quot;date_recieved&quot;);
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
	if(form.payment_recieved.checked!=true){
		form.date_recieved.value = year + &quot;-&quot; + month + &quot;-&quot; + day;
		alert:(this.form.date_recieved.value)
		form.payment_recieved.focus();
	}else{
		form.date_recieved.value = &quot;&quot;;
   		form.submit();
		}
	}
&lt;/script&gt;
          &lt;input name=&quot;payment_recieved&quot; type=&quot;checkbox&quot; id=&quot;payment_recieved&quot; value=&quot;&#039;Y&#039;&quot; onclick=&quot;check_paid(single_payment);&quot;/&gt;
          &lt;label for=&quot;payment_recieved&quot;&gt;&lt;/label&gt;
      &lt;input name=&quot;date_recieved&quot; type=&quot;hidden&quot; value=&quot;0000-00-00&quot; /&gt;
        &lt;p&gt;
          &lt;input type=&quot;submit&quot; name=&quot;submit&quot; id=&quot;submit&quot; value=&quot;Enter Single payment into system&quot; /&gt;
        &lt;/p&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;MM_insert&quot; value=&quot;single_payment&quot; /&gt;
        &lt;input name=&quot;student_id&quot; type=&quot;hidden&quot; id=&quot;student_id&quot; value=&quot;&lt;?php echo $row_Recordset1[&#039;student_id&#039;]; ?&gt;&quot; /&gt;
      &lt;/form&gt;



(Edited by tomeaglescz on 06-22-2010 00:18)

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 06-22-2010 08:23

sorry about that?
what&#039;s the question?
can you dump it into pastebin or such webservice?

tomeaglescz
Paranoid (IV) Inmate

From: Czech Republic via Bristol UK
Insane since: Feb 2002

posted posted 06-22-2010 17:47

hiya tp i think this should get you http://pastebin.com/f69nQXCx

trying to set the value of the hidden field to current date in yyyy-mm-dd format when its clicked on, need the value to to be inserted into the database when the whole form is completed.

cheers.

p.s. how the devil have u been.

(Edited by tomeaglescz on 06-22-2010 17:49)

tomeaglescz
Paranoid (IV) Inmate

From: Czech Republic via Bristol UK
Insane since: Feb 2002

posted posted 06-23-2010 08:32

http://pastebin.com/4RK3nJGe

ok got it working kind of but no matter what state i set the checkbox in i.e. checked/unchecked value Y or N or even force the value in the function i either get

a)correct date in date_recieved and N in payment_recieved
b) Y in payment_recieved and NULL in date_recieved

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 06-23-2010 18:28

ok, so the checkbox can either transmit an empty value, or &quot;&#039;N&#039;&quot; if it is checked... is that what you want?
If the checkbox is checked, it goes into the else, clears the date, you should receive &#039;N&#039; and an empty string (not null)
if it is not checked, you fill the field, and try to abort the form sending.

How is your &lt;form&gt; declared, specifcally, how are you calling check_paid(), if it&#039;s in on submit,
it should read onsubmit=&quot;check_paid(this)&quot; I guess, and check_paid should return false if it wants
to cancel the sending, and true if the form&#039;s ok.

so long,

->Tyberius Prime

tomeaglescz
Paranoid (IV) Inmate

From: Czech Republic via Bristol UK
Insane since: Feb 2002

posted posted 06-23-2010 20:22

check paid is being done onclick,

what should happen is if clicked it should set the va;ue of date recieved to current date, and set the paid value ie checkbox value to Y

however,

no matter what state i set the checkbox at it always returns an N so even if set at unchecked value N it wont post the value to function.

have to click again then it sets date but returns checkbox to N but correct date if u see what i am getting at.

Tyberius Prime
Maniac (V) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 06-24-2010 00:26

ok, seperate the checkbox from the value being transmitted, take a hidden value for that - that&#039;s always transmitted, the checkbox only get&#039;s transmitted if it&#039;s checked, so it&#039;s either &#039;N&#039; or NULL/unset, and do it in the form&#039;s onsubmit handler instead of onclick, returning false if you don&#039;t want the form to be submited - this also stops your user from just hitting enter and submitting it anyway.

tomeaglescz
Paranoid (IV) Inmate

From: Czech Republic via Bristol UK
Insane since: Feb 2002

posted posted 06-24-2010 01:20

cheers bud will give it a go will let ya know how i get on thx for the help

« BackwardsOnwards »

Show Forum Drop Down Menu