Jump to content
  • 0

Two buttons in the same line


thead
 Share

Question

Hello,

I have created a buttons into my DataPage but I can't align them in the same line. Please see below codes that I created and the screenshot of the output:

<center>
<a href="https://c0hbs831.caspio.com/dp/24f5a0009f29342371034eae9ecb" ><input type="submit" style="font-family:Arial;margin-bottom:3%;display:none;font-family:Arial;"  class="cbSubmitButton cbApprove" id="Approve" value="Approve"/></a>
<a href="https://c0hbs831.caspio.com/dp/24f5a0009f29342371034eae9ecb" ><input type="submit" style="font-family:Arial;margin-bottom:3%;display:none;font-family:Arial;" class="cbSubmitButton cbApprove" id="Save" value="Save"/></a>
<a href="https://c0hbs831.caspio.com/dp/24f5a0009f29342371034eae9ecb" ><input type="button" style="font-family:Arial;margin-bottom:3%;font-family:Arial;" class="cbSubmitButton cbApprove" id="Approve" value="Back"/></a>
</center>

<script>
if("[@field:Status]"=="Approved"){
document.getElementById('Save').style.display="block";
}
else if("[@field:Status]"=="Draft"){
document.getElementById('Approve').style.display="block";
}
else if("[@field:Status]"==""){
document.getElementById('Save').style.display="block";
}
document.getElementById('Save').onclick = function(){ 

document.getElementById('EditRecordStatus').value = "Draft";
};
document.getElementById('Approve').onclick = function(){ 

document.getElementById('EditRecordStatus').value = "Approved";
};
</script>

image.png.1d78beca600c73cede07b962ad86b0b1.png

Is it possible to align the two buttons in the same line?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hi Thead,

It is possible to show the two buttons in the same line you just need to replace your code into this:

<script>
if("[@field:Status]"=="Approved"){
document.getElementById('Save').style.display="inline-block";
}
else if("[@field:Status]"=="Draft"){
document.getElementById('Approve').style.display="inline-block";
}
else if("[@field:Status]"==""){
document.getElementById('Save').style.display="inline-block";
}
document.getElementById('Save').onclick = function(){

document.getElementById('EditRecordStatus').value = "Draft";
};
document.getElementById('Approve').onclick = function(){

document.getElementById('EditRecordStatus').value = "Approved";
};
</script>

Hope this helps.

Link to comment
Share on other sites

  • 0

What I usually do when I want to add custom button on my DataPage and I want to align it to the default button is to hide the button included to the DataPage. To do this I put the following script in my footer.

<!-- 2 input tags for the buttons -->

<input type="submit" name="Mod0EditRecord" id="Custom_Edit" value="Update" class="cbUpdateButton"> 
<input id="2nd_button" value="2nd Button" class="cbUpdateButton"> 

<script>

//Hide the ACTUAL button
document.querySelector("input[id*='Mod0EditRecord']").style.display = "none";
</script>

Output:

image.png.abd76a01c8d454ecfae8f044ac2c4a9c.png

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...