cancel
Showing results for 
Search instead for 
Did you mean: 

JS-validation and serverside events.

Former Member
0 Kudos

Hi,

I am doing some validations ( check if e-mail is filled ) on an input field through JavaScript. If there is a valid entry the serverside event may proceed.

If there isn't an entry I display a pop-up but I don't want to trigger the serverside event.

This is the code for the button :

<htmlb:button id = "order"

text = "<%= otr(zbc10/bestel) %>"

onClick = "me_Order"

onClientClick= "thx_win()"/>

And this is the JS :

function thx_win(){

var cfoo = document.getElementById("wa_head-email").value;

if (cfoo==""){

alert("<%= otr(zbc10/no_email) %>");

return false;

}

else{

thx_win = window.open("http:..../sap/zz_cust_caddie/confirmation2.htm",

"", 'toolbar, width=400,height=150');

}

}

Is there a way of doing this ?

Thanks in advance.

Dirk.

View Entire Topic
athavanraja
Active Contributor
0 Kudos

try this

<htmlb:button id = "SAV"

text = "Save Definition"

onClientClick = "var Check = document.getElementById('DID'); if(Check.value == ''){ alert('Enter Key Word'); htmlbevent.cancelSubmit = true; }"

onClick = "SAV"

design = "small"

width = "50" />

i am checking for a inputfield, if its empty i am throwing alert box and no server event.

Regards

Raja

Former Member
0 Kudos

Thanks Raja,

This is what I needed.

Are there any blogs out there regarding stuff like this : " htmlbevent.cancelSubmit = true; "

Dirk.

athavanraja
Active Contributor
0 Kudos

i dont know of a blog regarding this. i learnt this from htmlb_samples->radiobuttongroupsample.htm

Regards

Raja

maximilian_schaufler
Active Contributor
0 Kudos

Hi Dirk,

I don't think there is a blog for this, as this is "just" one variable that can be used for client side control of a form submit. After you tried one example using it there is little more to learn about it (unless you want to get really deep into all JS variables and scripts).

Max

Former Member
0 Kudos

Hello Max,

I thought, hoped there were a bunch of variables that I could use.

Therefore I looked for a blog.

Anyway, thanks.

Dirk.