Hi Folks
Can I do the following please:
In have a form for entering payments of invoices.
If they pay the whole ammount that is ok BUT if they only pay a part payment i wanna do the following.
On the form i have radion buttons (partpay yes & no) - I have the validation in place where they must select one or the other.
If they select yes i want an alert to show "enter this part payment in paidnotes" - This paid notes is a field also in the form.
This field however could already contain text about a previous payment.
What i need to do is send the focus of the "yes" radiobutton to the "paidnotes" field then check that they actually enter some text into that field - whether or not text already exists or not.

As far as i can make out this would be an "onchange" event but i do not have the experience to understand just how to do it.

Sorta like (in Plain english)
if yes is checked - make sure they type sumpin into the textbox "paidnotes" whether it already contains text or not.

The js validation i already have in place is (onsubmit)
if(!document.form1.partpay[0].checked && !document.form1.partpay[1].checked){
alert("Is this A Part Payment or Not?")
return false
}
if(document.form1.partpay[0].checked){
alert("DON'T FORGET To Record this Part Payment into the 'Part Payment Notes' Field");
document.form1.paidnotes.focus();
return false
}


PS "paidnotes" is a textbox field

Can anyone please help me with this.
cheers and thanks in advance
Grabit

if(document.form1.partpay[0].checked && document.form1.paidnotes.value != ""){
alert("DON'T FORGET To Record this Part Payment into the 'Part Payment Notes' Field");
document.form1.paidnotes.focus();
return false
}

does that help? :D

if(document.form1.partpay[0].checked && document.form1.paidnotes.value != ""){
alert("DON'T FORGET To Record this Part Payment into the 'Part Payment Notes' Field");
document.form1.paidnotes.focus();
return false
}

does that help? :D

That is what i had but if a previous text has been added to "paidnotes" then "paidnotes would not be empty so it will validate ok - right

I need it that if yes is selcected that even if "paid notes" is empty or not they have to enter something in that field
Does that have something to do with onkeydown?
sorta sumpin like

if yes is selected then they have to enter text into the "paidnotes' field, irrespective if it already contains text or not?

thanks for the answer and hopefully you can sort this for me

cheers
and thanks again
Grabit

can you be a little clearer? give a rundown of your desired behavior :)

Sorry i will give you the whole rundown
if a customer makes a part payment on an invoice i want to keep notes on how much they paid and when. so that when the invoice is paid in full i have a record sorta like:
"paid $200 21/09/09 - Paid "$100 on 22/09/09 - paid last installment $100 23/09/09"

so on my form i have a field "paidnotes" that i want to add to as i go.

When they make a payment i have radio buttons "is this a full payment or is this a part payment - Yes, No.
js validation ensures they select one or tuther.

If they select "yes" (it is a part payment) i want them redirected to the "paidnotes" textbox and they HAVE to enter something in there - EVEN if it already contains tex from a previously paid installment.

I should point out here that when the update form opens the "paidnotes" field is populated with any notes from past payments.
SO
i might or might not have a textbox field with a previously paid installment.
If this is the case i would already have (say) "paid $100 on 21/09/09" already in the field when the form opens.
I want them then to be able to add to that with the installment they are now entering.
So the validation i need is "have they entered the extra text to the "paidnotes" field, so that when the form action runs it updates the db column to the new text string that would then contain 2 entries.

basically what im saying is "have they entered text into the "paidnotes" field.
this must be regardless of whether there was existing text there already.

You might have noticed by now that i have trouble explaing things and tend to get a bit long winded in doing so - so i appologise for that

Hope this makes things a little clearer
cheers
Grabit

do you have skype coz i could contact you and i think i can explain better verbally than i can in words
if so and you dont mind me contacting you please give me your skpe address

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.