Originally Posted by
Acorn
You asked how to pass the information into your function.
You could just as easily use javascript:validate_forms("buttonId1")...
Acorn
Ah but I can't there in lies the crux of the matter. This is because of the way that variants and live sharing works in Xara. If I add that to one form button it will repeat across all the buttons in the variants.
What I am trying to do is to have 3 forms wide, desktop, mobile, each one has a button with specific id form_button_wide, form_button_desktop, form_button_mobile, then when one is clicked it's ID is used to call a validation function specific for that form using Switch like so.
Code:
function validate_forms(clicked_id) {
switch (clicked_id) {
case "btn_newsletter_wide":
validate_form_newsletter_wide(form);
break;
case "btn_newsletter_desktop":
validate_form_newsletter_desktop(form);
break;
case "btn_newsletter_mobile":
validate_form_newsletter_mobile(form);
break;
default:
alert(clicked_id);
}
}
In javascript it is easy to do as you can set the ID before an onclick event, but in Xara when you set an ID it comes after the Link to where the call is made causing an error. I really just need to send something unique from each form to triggers it's specific validation. Hope that makes more sense.
Bookmarks